From ba9de6773ba8cf181e7a3845a22d511ab32c37b8 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 22 Sep 2025 21:13:20 -0400 Subject: [PATCH] xo-cmake: xo-build args realclean, with-opengl --- xo-cmake/bin/xo-build.in | 51 ++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/xo-cmake/bin/xo-build.in b/xo-cmake/bin/xo-build.in index 378839ac..67b24cc9 100644 --- a/xo-cmake/bin/xo-build.in +++ b/xo-cmake/bin/xo-build.in @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euo pipefail + usage() { cat < 0 ]]; do case "$1" in @@ -103,6 +111,9 @@ while [[ $# > 0 ]]; do --install) install_flag=1 ;; + --realclean) + realclean_flag=1 + ;; --with-examples) with_examples=1 ;; @@ -112,6 +123,9 @@ while [[ $# > 0 ]]; do --debug-build) debug_build=1 ;; + --with-opengl=*) + with_opengl="${1#*=}" + ;; xo-*) xoname="$1" ;; @@ -131,7 +145,11 @@ if [[ -z "$pathtosource" ]]; then fi if [[ -z "$pathtobuild" ]]; then - pathtobuild=$xoname/.build + if [[ -n $xoname ]]; then + pathtobuild=$xoname/.build + else + pathtobuild=.build + fi fi SUBSYSTEMLIST_FILE=@CMAKE_INSTALL_FULL_DATADIR@/etc/xo/subsystem-list @@ -142,7 +160,7 @@ subsystem_list() { XO_REPO_STEM="https://github.com/Rconybea" -repo() { +printrepo() { xoname=$1 case "$xoname" in @@ -189,13 +207,13 @@ fi if [[ $repo_flag -eq 1 ]]; then if [[ -n "$xoname" ]]; then - repo $xoname + printrepo $xoname fi fi if [[ $clone_flag -eq 1 ]]; then if [[ -n "$xoname" ]]; then - url=$(repo $xoname) + url=$(printrepo $xoname) cmd="git clone $url" @@ -224,7 +242,12 @@ if [[ $configure_flag -eq 1 ]]; then cmakebuildtype="-DCMAKE_BUILD_TYPE=Debug" fi - cmd="cmake -DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ -DCMAKE_MODULE_PATH=@CMAKE_INSTALL_PREFIX@/share/cmake -S $pathtosource -B $pathtobuild ${testingarg} ${examplearg} ${cmakebuildtype}" + openglarg= + if [[ -n $with_opengl ]]; then + openglarg="-DXO_ENABLE_OPENGL=${with_opengl}" + fi + + cmd="cmake -DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ -DCMAKE_MODULE_PATH=@CMAKE_INSTALL_PREFIX@/share/cmake -S $pathtosource -B $pathtobuild ${testingarg} ${examplearg} ${openglarg} ${cmakebuildtype}" if [[ $noop_flag -eq 1 ]]; then echo $cmd @@ -269,3 +292,11 @@ if [[ $install_flag -eq 1 ]]; then fi fi fi + +if [[ $realclean_flag -eq 1 ]]; then + if [[ $noop_flag -eq 1 ]]; then + echo "rm -rf $pathtobuild" + else + rm -rf "${pathtobuild}" + fi +fi