Xrepo is a cross-platform C/C++ package manager based on Xmake.

  • Program source code
  • The official documentation

It is based on the runtime provided by Xmake, but is a fully independent package manager that provides more C/C++ packages for both platforms and architectures than package managers such as VCPKG/Homebrew.

It also supports multiple versions of semantics and is a decentralized distributed repository that not only provides the official Xmake-repo repository, but also allows users to build multiple private repositories.

Xrepo also supports package installation from third-party package managers such as VCPKG/Homebrew/Conan, and provides consistent library link information for easy integration and docking with third-party projects.

If you want to learn more, check out online documentation, Github, and Gitee

The installation

To use xrepo, you only need to install xmake. For details on how to install xmake, see the xmake installation documentation.

Support platform

  • Windows (x86, x64)
  • macOS (i386, x86_64, arm64)
  • Linux (i386, x86_64, cross-toolchains ..)
  • *BSD (i386, x86_64)
  • Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a)
  • iOS (armv7, armv7s, arm64, i386, x86_64)
  • MSYS (i386, x86_64)
  • MinGW (i386, x86_64, arm, arm64)
  • Cross Toolchains

Support for package management repositories

  • Xmake-repo (tbox >1.6.1)
  • User – built warehouses
  • Conan, Conan: : openssl / 1.1.1 g)
  • Vcpkg (vcpkg:ffmpeg)
  • Homebrew/Linuxbrew (brew::pcre2/libpcre2-8)
  • Pacman on archlinux/msys2 (pacman::libcurl)
  • Clib (Clib: : clibs/[email protected])
  • Dub, Dub: : log 0.4.3)

Distributed warehouse support

In addition to retrieving installation packages directly from the official repository: Xmake-repo, we can add as many self-built repositories as we want, and even maintain the installation integration of private packages only on the company’s internal network, completely isolated from the Internet.

Simply add your own repository address with the following command:

$ xrepo add-repo myrepo https://github.com/mygroup/myrepo
Copy the code

Seamless integration with Xmake’s engineering

add_requires("Tbox > 1.6.1." "."libuv master"."vcpkg::ffmpeg"."brew::pcre2/libpcre2-8")
add_requires("Conan: : openssl / 1.1.1 g", {alias = "openssl", optional = true.debug = true})
target("test")
    set_kind("binary")
    add_files("src/*.c")
    add_packages("tbox"."libuv"."vcpkg::ffmpeg"."brew::pcre2/libpcre2-8"."openssl")
Copy the code

Here is the overall architecture and compilation process for integrating with Xmake.

Quick learning

The installation package

The basic use

$ xrepo install zlib tbox
Copy the code

Installs the specified version package

Complete support for Semantic Versioning.

$ xrepo install "zlib 1.2.x"
$ xrepo install "Zlib > = 1.2.0"
Copy the code

Installs the specified platform package

$ xrepo install -p iphoneos -a arm64 zlib
$ xrepo install -p android [--ndk=/xxx] zlib
$ xrepo install -p mingw [--mingw=/xxx] zlib
$ xrepo install -p cross --sdk=/xxx/arm-linux-musleabi-cross zlib
Copy the code

Install the debug version package

$ xrepo install -m debug zlib
Copy the code

Install the dynamic library version pack

$ xrepo install -k shared zlib
Copy the code

Installs the specified configuration package

$ xrepo install -f "vs_runtime=MD" zlib
$ xrepo install -f "regex=true,thread=true" boost
Copy the code

Install packages for third-party package managers

$ xrepo install brew::zlib
$ xrepo install vcpkg::zlib
$Xrepo install conan: : zlib / 1.2.11
$ xrepo install pacman:libpng
$ xrepo install dub:log
Copy the code

Find library usage information for packages

$ xrepo fetch pcre2{{linkdirs = {"/usr/local/Cellar/pcre2/10.33 / lib "}, the links = {" pcre2-8 "}, defines = {" PCRE2_CODE_UNIT_WIDTH = 8 "}, Includedirs = "/ usr/local/Cellar/pcre2/10.33 / include"}}Copy the code
$ xrepo fetch --ldflags openssl- L/Users/ruki /. Xmake/packages/o/openssl / 1.1.1 / d639b7d6e3244216b403b39df5101abf/lib - lcrypto - LSSLCopy the code
$ xrepo fetch --cflags openssl-i/Users/ruki /. Xmake/packages/o/openssl / 1.1.1 / d639b7d6e3244216b403b39df5101abf/includeCopy the code
$ xrepo fetch -p [iphoneos|android] --cflags "zlib 1.2.x"-i/Users/ruki /. Xmake/packages/z/zlib / 1.2.11 df72d410e7e14391b1a4375d868a240c/includeCopy the code
$Xrepo fetch --cflags -- LDFlags Conan ::zlib/1.2.11-i/Users/ruki /. Conan/data/zlib / 1.2.11 / _ / _ / package/f74366f76f700cc6e991285892ad7a23c30e6d47 / include - L/Users/ruki /. Conan/data/zlib / 1.2.11 / _ / _ / package/f74366f76f700cc6e991285892ad7a23c30e6d47 / lib - lzCopy the code

Export the installation package

Xrepo can quickly export installed packages, including corresponding library files, header files, and so on.

$ xrepo export -o /tmp/output zlib
Copy the code

Search for supported packages

$ xrepo search zlib "pcr*"
    zlib:
      -> zlib: A Massively Spiffy Yet Delicately Unobtrusive Compression Library (in xmake-repo)
    pcr*:
      -> pcre2: A Perl Compatible Regular Expressions Library (in xmake-repo)
      -> pcre: A Perl Compatible Regular Expressions Library (in xmake-repo)
Copy the code

View package environment information

$ xrepo env --show luajit{ OLDPWD = "/mnt/tbox", HOME = "/home/ruki", PATH = "/ home/ruki /. Xmake/packages/l/luajit / 2.1.0 -beta3 / fbac76d823b844f0b91abf3df0a3bc61 / bin: / TMP/TMP/arm - Linux - musleabi - cross /bin:~/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", TERM = "xterm", PWD = "/mnt/xmake", XMAKE_PROGRAM_DIR = "/mnt/xmake/xmake", HOSTNAME = "e6edd61ff1ab", LD_LIBRARY_PATH = "/ home/ruki /. Xmake/packages/l/luajit / 2.1.0 -beta3 / fbac76d823b844f0b91abf3df0a3bc61 / lib", SHLVL = "1", _ = "/mnt/xmake/scripts/xrepo.sh" }Copy the code

Load the execution package environment and run the command

$ xrepo env luajit
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
>
Copy the code
$ xrepo env -b "luajit 2.x" luajit
$ xrepo env -p iphoneos -b "zlib,libpng,luajit 2.x" cmake ..
Copy the code

Viewing Package Information

$ xrepo info zlibThe package info of project: require(zlib): -> description: A Massively Spiffy Yet Delicately Unobtrusive Compression Library -> version: 1.2.11 -> urls: - > http://zlib.net/zlib-1.2.11.tar.gz - > c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 - > https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz - > c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 -> repo: xmake-repo https://gitee.com/tboox/xmake-repo.git master -> cachedir: / Users/ruki /. Xmake/cache/packages / 2010 / z/zlib / 1.2.11 - > installdir: / Users/ruki /. Xmake/packages/z/zlib / 1.2.11 / d639b7d6e3244216b403b39df5101abf - > searchdirs: - > searchnames: Zlib-1.2.11.tar. gz -> fetchinfo: 1.2.11, system -> version: 1.2.11 -> links: z -> linkdirs: / usr/local/Cellar/zlib / 1.2.11 / lib - > includedirs: / usr/local/Cellar/zlib / 1.2.11 / include - > platforms: iphoneos, mingw@windows, macosx, mingw@linux,macosx, android@linux,macosx, windows, linux -> requires: -> plat: macosx -> arch: x86_64 -> configs: -> debug: false -> vs_runtime: MT -> shared: false -> configs: -> configs (builtin): -> debug: Enable debug symbols. (default: false) -> shared: Enable shared library. (default: false) -> cflags: Set the C compiler flags. -> cxflags: Set the C/C++ compiler flags. -> cxxflags: Set the C++ compiler flags. -> asflags: Set the assembler flags. -> vs_runtime: Set vs compiler runtime. (default: MT) -> values: {"MT","MD"}Copy the code

Tboox.org/cn/2020/11/…