Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
/pmmPublic archive
forked fromvector-of-bool/pmm

📦 📭 It's the C++ Package Manager Manager

License

NotificationsYou must be signed in to change notification settings

AnotherFoxGuy/pmm

 
 

Repository files navigation

PMM

PMM - The Package Manager Manager

build-statusreleaselast commitstarsforksissuesissues-prcontributors

PMM is a module for CMake that manages... package managers.

Wha- Why?

People hate installing new software. Especially when they already have aperfectly working tool present. PMM uses the CMake scriptinglanguage to manage external packaging tools. PMM will automaticallydownload, install, and control package managers from within your CMakeproject.

(As you are reading this, only Conan and VCPKG are supported.)

But This is JustAnother Tool I have to Manage!

Never fear! PMM is the lowest-maintenance software you will ever use.

How Do I Use PMM?

Using PMM is simple:

  1. Download thepmm.cmake file, and place it at the top level of your repository(alongside yourCMakeLists.txt).
  2. In yourCMakeLists.txt, add a lineinclude(pmm.cmake).
  3. Call thepmm() CMake function.

That's it! Thepmm.cmake file is just 23 significant lines. Take a look insideif you doubt.

Wait... It's Downloading a Bunch of Stuff!

Precisely!pmm.cmake is just a bootstrapper for the real PMM code, whichcan be found in thepmm/ directory in the repository. The content isserved over HTTPS from thegh-pages branch of the PMM repository, so it is all publicly visible.

I Don't Want to Automatically Download and Run Code from the Internet

Great! I sympathize, but remember: If you runapt,yum,pip, or evenconan, you are automatically downloading and running code from theinternet. It's all about whose code youtrust.

Even still, you can host the PMM code yourself: Download thepmm/directory as you want it, and modify thepmm.cmake script to downloadfrom your alternate location (eg, a corporate engineering intranet server).

Will PMM Updates Silently Break my Build?

Nope.pmm.cmake will never automatically change the version of PMM thatit uses, and the files served will never be modified in-place: New versionswill beadded, but old versions will remain unmodified.

PMM will notify you if a new version is available, but it won't be annoyingabout it, and you can always disable this nagging by settingPMM_IGNORE_NEW_VERSION before includingpmm.cmake.

How do I Change the PMM Version?

There are two ways:

  1. SetPMM_VERSION before including thepmm.cmake script.
  2. Modify thePMM_VERSION_INIT value at the top ofpmm.cmake.

Prefer (1) for conditional/temporary version changes, and (2) for permanentversion changes.

How do I Change the Download Location for PMM?

For permanent changes, setPMM_URL and/orPMM_URL_BASE inpmm.cmake.For temporary changes, setPMM_URL before includingpmm.cmake

Thepmm() Function

The only interface to PMM (after includingpmm.cmake) is thepmm()CMake function. Using it is very simple. At the time or writing,pmm()only supports Conan and vcpkg, but other packaging solutions may be supportedin the future.

TheVERBOSE andDEBUG options enable verbose and debug logging,respectively. You may setPMM_{DEBUG,VERBOSE} beforeinclude(pmm.cmake) toenable these options globally and see information about the PMM bootstrappingprocess.

Thepmm() signature:

pmm(# Enable verbose logging    [VERBOSE]# Enable debug logging (implies VERBOSE)    [DEBUG]# Use Conan    [CONAN# Set additional --setting flags        [SETTINGS ...]# Set additional --option flags        [OPTIONS ...]# Set the --build option. (Default is `missing`)        [BUILD <policy>]# Use a custom profile instead of the auto-generated profile created by PMM        [PROFILE <profile_name>]# Ensure remotes are present before installing        [REMOTES [<name>[::no_verify] <url> [...]]]# Enable the Bincrafters repository        [BINCRAFTERS]# Enable the conan-community repository        [COMMUNITY]    ]# Use vcpkg    [VCPKG# Specify the revision of vcpkg that you want to use (required)        REVISION <rev># Ensure the given packages are installed using vcpkg        [REQUIRES [req [...]]]# Copy custom ports to the vcpkg ports directory        [PORTS [req [...]]]    ]# Use CMakeCM    [CMakeCM# Either use the latest release, or specify a specific base URL to# download from        {ROLLING | FROM <base-url>}    ])

CONAN PMM mode

InCONAN mode, PMM will find, obtain, and use Conan to manage projectpackages.

PMM will always use thecmake Conan generator, and will define importedtargets for consumption (Equivalent ofconan_basic_setup(TARGETS)). It willalso setCMAKE_PREFIX_PATH andCMAKE_MODULE_PATH for you to usefind_package() andinclude() against the installed dependencies.

NOTE: No other CMake variables from regular Conan usage are defined.

CONAN mode requires aconanfile.txt orconanfile.py in your projectsource directory. It will runconan install against this file to obtaindependencies for your project.

The nitty-gritty of how PMM finds/obtains Conan:

  1. Check for theCONAN_EXECUTABLE variable. If found, it is used.
  2. Try to find aconan executable. Searches:
    1. Anypyenv versions in the user home directory
    2. ~/.local/bin for user-mode install binaries
    3. C:/Python{36,27,}/Scripts for Conan installations
    4. Anything else onPATH
  3. If still no Conan, attempts to obtain one automatically, trying firstPython 3, then Python 2:
    1. Check for avenv orvirtualenv executable Python module.
    2. Create a user-local virtualenv.
    3. Installs Conanwithin the created virtualenv and uses Conan from there.

PMM Will Not doEverything for You

While PMM will ensure that Conan has been executed for you as part of yourconfigure stage, it is up to you to provide a Conanfile that Conan can consumeto get your dependency information.

You will still need to read the Conan documentation to understand the basics ofhow to declare and consume your dependencies.

VCPKG PMM mode

InVCPKG mode, PMM will download the vcpkg repository at the givenREVISION, build thevcpkg tool, and manage the package installation in ause-local data directory.

REVISION should be a git tree-ish (A revision number (preferred), branch,or tag) that you couldgit checkout from the vcpkg repository. PMM willdownload the specified commit from GitHub and build thevcpkg command linetool from source.You will needstd::filesystem orstd::experimental::filesystem support from yourcompiler and standard library.

If you want to copy custom ports to the vcpkg ports folder, you can definePORTS with a list of folders to copy over.

REQUIRES is a list of packages that you would like to install using thevcpkg command line tool.

When using PMM, you do not need to use thevcpkg.cmake CMake toolchainfile: PMM will take care of this aspect for you.

After callingpmm(VCPKG), all you need to do isfind_package() thepackages that you want to use.

CMakeCM PMM mode

IfCMakeCM is provided, PMM will download and make available theCMakeCommunity Modules for you project.

Once thepmm() function is run, you mayinclude orfind_package any of themodules provided byCMakeCM.

You must also specify eitherROLLING orFROM <base-url> to use CMakeCM withPMM:

  • If you specifyROLLING, PMM will download the latest version of the CMakeCMmodule index every time you configure (with a few minutes of cooldown).
  • If you specifyFROM, the module index will only be obtained from the givenbase URL.Note: This URLis not the URL of aCMakeCM.cmake file: Itis a url thatprefixes theCMakeCM.cmake module URL.

Helper Commands

After PMM has run for the first time, it will generate a sh and bat script that can be used to maintain your PMM installation

Get help with the/Help option:

> pmm-cli.sh /Help

As an example, you can rebuild a Conan package with this command:

> pmm-cli.sh /Conan /Rebuild<package name>

[8]ページ先頭

©2009-2025 Movatter.jp