xo-cmake: + subsystem-list + xo-build improvements

This commit is contained in:
Roland Conybeare 2025-05-10 12:04:18 -05:00
commit f510700b99
4 changed files with 99 additions and 46 deletions

View file

@ -47,6 +47,13 @@ install(
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
FILES
"etc/xo/subsystem-list"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
DESTINATION ${CMAKE_INSTALL_DATADIR}/etc/xo
)
# The cmake template gen-ccov.in should be expanded in downstream project;
# to pickup downstream project's PROJECT_SOURCE_DIR / PROJECT_BINARY_DIR
#

View file

@ -1,7 +1,12 @@
#!/usr/bin/env bash
usage() {
echo "$0 [-u|--usage|-h|--help] [--xoname=NAME] [--repo]"
cat <<EOF
$0 [-u|--usage|-h|--help]
[--list] [-n] [--xoname=NAME]
[--repo|--clone|--configure|--build|--install]
[-S=SOURCEDIR] [-B=BUILDDIR]
EOF
}
help() {
@ -14,7 +19,7 @@ fetch and/or build xo component libraries
Options:
-u | --usage brief help message
-h | --help this help message
--list list known xo library
--list list known xo libraries
-n dry-run: don't actually invoke state-changing commands
--xoname=NAME operate on xo subsystem NAME
--repo report github repo for NAME
@ -23,6 +28,8 @@ Options:
Will use NAME/.build as build directory
--build run cmake build for xo library NAME in immediate subdir
--install run cmake install for xo library NAME in immediate subdir
-S=SOURCEDIR override path/to/source
-B=BUILDDIR override path/to/build
EOF
}
@ -33,6 +40,8 @@ clone_flag=0
configure_flag=0
build_flag=0
install_flag=0
pathtosource=
pathtobuild=
while [[ $# > 0 ]]; do
case "$1" in
@ -45,6 +54,20 @@ while [[ $# > 0 ]]; do
-n)
noop_flag=1
;;
-S)
shift
pathtosource=$1
;;
-S=*)
pathtosource="${1#*=}"
;;
-B)
shift
pathtobuild=$1
;;
-B=*)
pathtobuild="${1#*=}"
;;
--list)
cmd='list'
;;
@ -78,21 +101,20 @@ while [[ $# > 0 ]]; do
shift
done
echo xoname=$xoname pathtosource=$pathtosource pathtobuild=$pathtobuild
if [[ -z "$pathtosource" ]]; then
pathtosource=$xoname
fi
if [[ -z "$pathtobuild" ]]; then
pathtobuild=$xoname/.build
fi
SUBSYSTEMLIST_FILE=@CMAKE_INSTALL_FULL_DATADIR@/etc/xo/subsystem-list
subsystem_list() {
cat <<EOF
xo-cmake
xo-indentlog
xo-refcnt
xo-subsys
xo-ratio
xo-reflect
xo-pyutil
xo-pyreflect
xo-expression
xo-pyexpression
xo-jit
xo-pyjit
EOF
cat ${SUBSYSTEMLIST_FILE}
}
XO_REPO_STEM="https://github.com/Rconybea"
@ -101,9 +123,6 @@ repo() {
xoname=$1
case "$xoname" in
xo-cmake)
echo "${XO_REPO_STEM}/xo-cmake.git"
;;
xo-indentlog)
echo "${XO_REPO_STEM}/indentlog.git"
;;
@ -113,33 +132,16 @@ repo() {
xo-subsys)
echo "${XO_REPO_STEM}/subsys.git"
;;
xo-ratio)
echo "${XO_REPO_STEM}/xo-ratio.git"
;;
xo-reflect)
echo "${XO_REPO_STEM}/reflect.git"
;;
xo-pyutil)
echo "${XO_REPO_STEM}/xo-pyutil.git"
;;
xo-pyreflect)
echo "${XO_REPO_STEM}/xo-pyreflect.git"
;;
xo-expression)
echo "${XO_REPO_STEM}/xo-expression.git"
;;
xo-pyexpression)
echo "${XO_REPO_STEM}/xo-pyexpression.git"
;;
xo-jit)
echo "${XO_REPO_STEM}/xo-jit.git"
;;
xo-pyjit)
echo "${XO_REPO_STEM}/xo-pyjit.git"
;;
*)
echo "$0: unknown xo component [${xoname}]"
return 1
if grep -q $1 ${SUBSYSTEMLIST_FILE}; then
echo "${XO_REPO_STEM}/${1}.git"
else
>&2 echo "$0: unknown xo component [${xoname}]"
return 1
fi
esac
return 0
@ -183,7 +185,7 @@ fi
if [[ $configure_flag -eq 1 ]]; then
if [[ -n "$xoname" ]]; then
cmd="cmake -DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ -S $xoname -B $xoname/.build"
cmd="cmake -DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ -S $pathtosource -B $pathtobuild"
if [[ $noop_flag -eq 1 ]]; then
echo $cmd
@ -195,7 +197,7 @@ fi
if [[ $build_flag -eq 1 ]]; then
if [[ -n "$xoname" ]]; then
cmd="cmake --build $xoname/.build -j"
cmd="cmake --build $pathtobuild -j"
if [[ $noop_flag -eq 1 ]]; then
echo $cmd
@ -207,7 +209,7 @@ fi
if [[ $install_flag -eq 1 ]]; then
if [[ -n "$xoname" ]]; then
cmd="cmake --install $xoname/.build"
cmd="cmake --install $pathtobuild"
if [[ $noop_flag -eq 1 ]]; then
echo $cmd

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
usage() {
echo "$0 [-u|--usage|-h|--help|--lcov-exe|--genhtml-exe|--lcov-harness-exe|--gen-ccov-template|--cmake-module-path]" 1>&2
echo "$0 [-u|--usage|-h|--help|--lcov-exe|--genhtml-exe|--lcov-harness-exe|--gen-ccov-template|--cmake-module-path|--subsystem-list]" 1>&2
}
help() {
@ -20,6 +20,7 @@ Options:
--lcov-harness-exe report path to 'xo-cmake-lcov-harness' executable
--gen-ccov-template report path to 'gen-ccov.in' template
--doxygen-template report path to 'Doxyfile.in' template
--subsystem-list report path to 'subsystem-ilst'
EOF
}
@ -50,6 +51,9 @@ while [[ $# > 0 ]]; do
--doxygen-template)
cmd='doxygen_template'
;;
--subsystem-list)
cmd='subsystem_list'
;;
*)
usage
exit 1
@ -77,4 +81,6 @@ elif [[ $cmd == 'gen_ccov_template' ]]; then
echo -n @CMAKE_INSTALL_FULL_DATADIR@/xo-macros/gen-ccov.in
elif [[ $cmd == 'doxygen_template' ]]; then
echo -n @CMAKE_INSTALL_FULL_DATADIR@/xo-macros/Doxyfile.in
elif [[ $cmd == 'subsystem_list' ]]; then
echo -n @CMAKE_INSTALL_FULL_DATADIR@/etc/xo/subsystem-list
fi

38
etc/xo/subsystem-list Normal file
View file

@ -0,0 +1,38 @@
xo-cmake
xo-indentlog
xo-refcnt
xo-subsys
xo-randomgen
xo-ordinaltree
xo-pyutil
xo-flatstring
xo-reflectutil
xo-reflect
xo-pyreflect
xo-ratio
xo-unit
xo-pyunit
xo-expression
xo-pyexpression
xo-tokenizer
xo-reader
xo-jit
xo-pyjit
xo-callback
xo-webutil
xo-pywebutil
xo-printjson
xo-pyprintjson
xo-reactor
xo-pyreactor
xo-websock
xo-pywebsock
xo-statistics
xo-distribution
xo-pydistribution
xo-simulator
xo-pysimulator
xo-process
xo-pyprocess
xo-kalmanfilter
xo-pykalmanfilter