All Projects → pfultz2 → Cmake Get

pfultz2 / Cmake Get

Get dependencies with cmake

Programming Languages

c
50402 projects - #5 most used programming language
cpp
1120 projects
cplusplus
227 projects

Projects that are alternatives of or similar to Cmake Get

Cpm.cmake
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
Stars: ✭ 560 (+849.15%)
Mutual labels:  cmake, cross-platform, package-manager, dependency-manager
Cget
C++ package retrieval
Stars: ✭ 370 (+527.12%)
Mutual labels:  cmake, osx, package-manager, dependency-manager
Div Games Studio
Complete cross platform games development package, originally for DOS but now available on modern platforms.
Stars: ✭ 168 (+184.75%)
Mutual labels:  cmake, cross-platform, osx
Patch Package
Fix broken node modules instantly 🏃🏽‍♀️💨
Stars: ✭ 6,062 (+10174.58%)
Mutual labels:  package-manager, dependency-manager
Uikit Cross Platform
Cross-platform Swift implementation of UIKit, mostly for Android
Stars: ✭ 421 (+613.56%)
Mutual labels:  cmake, cross-platform
Qt Nice Frameless Window
Qt Frameless Window for both Windows and OS X, support Aero Snap, drop shadow on Windows, and support Native Style such as round corner, drop shadow on OS X. Based on QMainWindow.
Stars: ✭ 430 (+628.81%)
Mutual labels:  cross-platform, osx
Conan
Conan - The open-source C/C++ package manager
Stars: ✭ 5,498 (+9218.64%)
Mutual labels:  cmake, package-manager
Screencloud
Screenshot sharing application for Windows, Mac and Linux.
Stars: ✭ 537 (+810.17%)
Mutual labels:  cmake, cross-platform
Bulllord Engine
lightspeed lightweight elegant game engine in pure c
Stars: ✭ 539 (+813.56%)
Mutual labels:  cross-platform, osx
Modern Cpp Template
A template for modern C++ projects using CMake, Clang-Format, CI, unit testing and more, with support for downstream inclusion.
Stars: ✭ 690 (+1069.49%)
Mutual labels:  cmake, package-manager
Projeny
A project and package manager for Unity
Stars: ✭ 656 (+1011.86%)
Mutual labels:  package-manager, dependency-manager
Composer
Dependency Manager for PHP
Stars: ✭ 25,994 (+43957.63%)
Mutual labels:  package-manager, dependency-manager
Mumble
Mumble is an open-source, low-latency, high quality voice chat software.
Stars: ✭ 4,418 (+7388.14%)
Mutual labels:  cmake, cross-platform
Cmake Conan
CMake wrapper for conan C and C++ package manager
Stars: ✭ 374 (+533.9%)
Mutual labels:  cmake, package-manager
Tprpix
a Cross-Platform, 2D Survival Sandbox Game Project. Based on C++17/cmake/OpenGL/SQLite3.
Stars: ✭ 448 (+659.32%)
Mutual labels:  cmake, cross-platform
Ark
ARK is a lightweight, agility, elastic, distributed plugin framework written in C++,make it easier and faster to create your own application service.
Stars: ✭ 370 (+527.12%)
Mutual labels:  cmake, cross-platform
Qpmx
A frontend for qpm, to provide source and build caching
Stars: ✭ 13 (-77.97%)
Mutual labels:  cross-platform, package-manager
Obengine
2D Game Engine with Lua Scripting made on top of SFML !
Stars: ✭ 335 (+467.8%)
Mutual labels:  cmake, cross-platform
Athens
A Go module datastore and proxy
Stars: ✭ 3,736 (+6232.2%)
Mutual labels:  package-manager, dependency-manager
Arxlibertatis
Cross-platform port of Arx Fatalis, a first-person role-playing game
Stars: ✭ 602 (+920.34%)
Mutual labels:  cmake, cross-platform

cmake-get

A cmake module to get dependencies. This module can be used in config mode or in script mode.

Installation

The module is just one file 'CMakeGet.cmake' which can be copied into your project and then included. It can also be installed with cmake:

mkdir build
cd build
cmake ..
cmake --build . --target install

And then it can be used with find_package(CMakeGet).

Config mode

In config mode, this is similiar to cmake's ExternalProject with some differences:

  • Dependencies are installed during cmake configuration instead of during build. This avoids the need of writing super build projects as cmake's find_* commands can be used to find the dependencies all in the same build project.
  • Non-cmake build steps can be put in a recipe that can be shared and re-used by many users, instead of rewriting the build steps for every projects.
  • A BUILD_DEPS variable is provided to enable the installation of dependencies(it defaults to OFF). This allows dependencies to be disabled for when a user wants to use a package manager to install the dependencies, but then can be enabled when the user doesn't want to use a package manager.

To setup with cmake, first list the dependecies in a requirements.txt file and the add something like this to cmake:

cmake_get_from(requirements.txt PREFIX ${CMAKE_CURRENT_BINARY_DIR}/deps)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/deps)

Also, if recipes are used, its best not to list them in the requirements.txt file. Instead just install them in the cmake itself:

cmake_get(pfultz2/cget-recipes PREFIX ${CMAKE_CURRENT_BINARY_DIR}/deps)
cmake_get_from(requirements.txt PREFIX ${CMAKE_CURRENT_BINARY_DIR}/deps)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/deps)

Of course, this still has the same weakness as ExternalProject as the toolchain is not transitive.

Script mode

Script mode enables the ability to write a cmake script to install a dependency. This can help with toolchain transitivity as the user can invoke the script with all the same cmake settings. The disadvantage is that the user has an extra step to install dependencies. For example, a script 'dependencies.cmake' like this could be made to install dependencies from a 'requirements.txt':

#!/usr/bin/env cmake -P

set(ARGS)
foreach(i RANGE 4 ${CMAKE_ARGC})
    list(APPEND ARGS ${CMAKE_ARGV${i}})
endforeach()

set(_PREFIX ${CMAKE_ARGV3})

# Make sure this is in the module path
list(APPEND CMAKE_MODULE_PATH ${CMAKEGET_MODULE_PATH})
include(CMakeGet)

get_filename_component(PREFIX ${_PREFIX} ABSOLUTE)
# Install recipes
cmake_get(pfultz2/cget-recipes PREFIX ${PREFIX} CMAKE_ARGS ${ARGS})
cmake_get_from(requirements.txt PREFIX ${PREFIX} CMAKE_ARGS ${ARGS})

So then the user would run this instead:

./dependencies.cmake deps/
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=../deps/ ..

Reference

cmake_get

cmake_get(<pkg>
    [PREFIX <prefix>]
    [HASH <hash>]
    [CMAKE_FILE <cmake-file>]
    [CMAKE_ARGS <args>...]
)

This will install a cmake package. It will run something equivalent to this in order to install the package:

mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=${PREFIX} -DCMAKE_INSTALL_PREFIX=${PREFIX} ${CMAKE_ARGS}
cmake --build .
cmake --build . --target install
  • <pkg>
    This is the package to be installed as described here. It can be a URL or even a recipe.
  • PREFIX <prefix>
    This is prefix to where the package will be installed.
  • HASH <hash>
    This is a checksum hash that will be checked on a package.
  • CMAKE_FILE <cmake-file>
    This is a cmake file that will be used to build the package. This is useful for a package that does not provide a cmake file already.
  • CMAKE_ARGS <args>...
    This is additional cmake arguments that are passed to the configuration step.

cmake_get_from

cmake_get_from(<filename>
    [PREFIX <prefix>]
    [CMAKE_ARGS <args>...]
)

This will install a list of packages stored in a file.

  • <filename>
    This a file that will list packages to be installed, The format of the file is described here.
  • PREFIX <prefix>
    This is prefix to where the package will be installed.
  • CMAKE_ARGS <args>...
    This is additional cmake arguments that are passed to the configuration step.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].