From 4b8fab54c346c5590cc609d99e40d4b7cba29cda Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 14 Jun 2024 15:13:53 -0400 Subject: [PATCH] xo-cmake: + xo-build assistant --- CMakeLists.txt | 7 ++ README.md | 2 + bin/xo-build.in | 214 +++++++++++++++++++++++++++++++++++++++++ bin/xo-cmake-config.in | 2 +- 4 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 bin/xo-build.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e28d3f..4b7c103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,12 @@ configure_file( @ONLY ) +configure_file( + ${PROJECT_SOURCE_DIR}/bin/xo-build.in + ${PROJECT_BINARY_DIR}/xo-build + @ONLY + ) + install( FILES "cmake/xo_macros/xo-project-macros.cmake" @@ -36,6 +42,7 @@ install( FILES "${PROJECT_BINARY_DIR}/xo-cmake-lcov-harness" "${PROJECT_BINARY_DIR}/xo-cmake-config" + "${PROJECT_BINARY_DIR}/xo-build" PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/README.md b/README.md index db3b4dd..8ccf76b 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ $ cp $PREFIX/share/xo-macros/xo-bootstrap-macros.cmake cmake/ then in `foo/CMakeLists.txt`: ``` include(cmake/xo-bootstrap-macros.cmake) + +xo_cxx_toplevel_options3() ``` Now as long as `$PREFIX/bin` is in `PATH`: diff --git a/bin/xo-build.in b/bin/xo-build.in new file mode 100644 index 0000000..dbbfc18 --- /dev/null +++ b/bin/xo-build.in @@ -0,0 +1,214 @@ +#!/usr/bin/env bash + +usage() { + echo "$0 [-u|--usage|-h|--help] [--xoname=NAME] [--repo]" +} + +help() { + usage + + cat < 0 ]]; do + case "$1" in + -u | --usage) + cmd='usage' + ;; + -h | --help) + cmd='help' + ;; + -n) + noop_flag=1 + ;; + --list) + cmd='list' + ;; + --xoname=*) + xoname="${1#*=}" + ;; + --repo) + repo_flag=1 + ;; + --clone) + clone_flag=1 + ;; + --configure|--config) + configure_flag=1 + ;; + --build) + build_flag=1 + ;; + --install) + install_flag=1 + ;; + xo-*) + xoname="$1" + ;; + *) + usage + exit 1 + ;; + esac + + shift +done + +subsystem_list() { + cat <