Skip to main content

A small C/C++ helper library

Project description

Loco-Utils

A small set of C/C++ helper functions and macros that I used alongside various projects related to the Loco framework I'm currently developing.

Build Status

Build Status
Ubuntu ci-linux
Windows ci-windows
MacOS ci-macos

How to Use

This is a CMake based project, and all dependencies are managed by this tool itself (i.e., we make use of FetchContent), so no additional dependencies have to be installed. So, there are two ways you can use this project alongside yours:

  • Include via add_subdirectory: This is the quickest way to integrate the project alongside yours. You'll have to download the source code to some folder either by cloning the repo, or by adding it as a git-submodule. Either way, let's say you placed the source into SOME_FOLDER/loco_utils. Then you'll just have to do the following in some part of your CMake setup:

      # On some part of your CMake configuration rules
      add_subdirectory(SOME_FOLDER/loco_utils)
    
  • Get it via FetchContent: This is an option that doesn't require for you to directly clone or link the repo. You can use FetchContent and FetchContent_MakeAvailable to add this project directly into your CMake build workflow, as shown below:

      # Set where to place source-code and where to place binaries/logs
      set(SOME_SRC_PATH "Some-source-path-here")
      set(SOME_BUILD_PATH "Some-build-path-here")
      # Define some extra cmake-args to pass to this project (loco_utils)
      set(SOME_CMAKE_ARGS "-DLOCOUTILS_BUILD_EXAMPLES=OFF -DLOCOUTILS_BUILD_DOCS=OFF")
      # On some part where you setup third-party dependencies
      FetchContent(loco_utils
          GIT_REPOSITORY "https://github.com/wpumacay/loco_utils.git"
          GIT_PROGRESS TRUE
          USES_TERMINAL_DOWNLOAD TRUE
          PREFIX "${SOME_SRC_PATH}/loco_utils"
          DOWNLOAD_DIR "${SOME_SRC_PATH}/loco_utils"
          SOURCE_DIR "${SOME_SRC_PATH}/loco_utils/source"
          BINARY_DIR "${SOME_BUILD_PATH}/loco_utils/build"
          STAMP_DIR "${SOME_BUILD_PATH}/loco_utils/stamp"
          TMP_DIR "${SOME_BUILD_PATH}/loco_utils/tmp"
          CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
                     -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
                     -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
                     -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
                     -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
                     -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
                     -DCMAKE_INSTALL_DOCDIR=${CMAKE_INSTALL_DOCDIR}
                     -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
                     -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
                     ${SOME_CMAKE_ARGS}
          BUILD_ALWAYS OFF)
    
  • Install and use find_package: This last option is not available yet, but once we add the install rules for the CMake project, you'll be able to just install the library into your system, import it using find_package, and linking using the exposed LocoUtilsCpp target, as shown below:

    • Installing the project
      mkdir build
      cmake -S . -B build
      cmake --build build
      cmake --install build
    
    • Including using find_package
      # Locate the installed project using find_package()
      find_package(LocoUtils REQUIRED)
    

Install the Python bindings

There are some Python bindings (generated using Pybind11), which you can install using the provided setup.py script. Just run either python setup.py install, or pip install --verbose . (add verbose just to check if everything went well)

  # Install python bindings
  # Option-1
  python setup.py install
  # Option-2
  pip install --verbose .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wp-utils-0.2.10.tar.gz (29.3 kB view hashes)

Uploaded Source

Built Distributions

wp_utils-0.2.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

wp_utils-0.2.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

wp_utils-0.2.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

wp_utils-0.2.10-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

wp_utils-0.2.10-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page