xo-cmake: xo-build args realclean, with-opengl
This commit is contained in:
parent
e41be4bff2
commit
ba9de6773b
1 changed files with 41 additions and 10 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
$0 [-u|--usage|-h|--help]
|
||||
|
|
@ -30,29 +32,35 @@ Options:
|
|||
--build run cmake build for xo library NAME in immediate subdir
|
||||
--build-docs build documentation for xo library NAME in immediate subdir
|
||||
--install run cmake install for xo library NAME in immediate subdir
|
||||
--realclean nuke build directory
|
||||
|
||||
-S=SOURCEDIR override path/to/source
|
||||
-B=BUILDDIR override path/to/build
|
||||
-S=SOURCEDIR override path/to/source
|
||||
-B=BUILDDIR override path/to/build
|
||||
|
||||
--with-examples in configure step, set -DXO_ENABLE_EXAMPLES=1
|
||||
--with-utests in configure step, set -DENABLE_TESTING=1
|
||||
--debug-build in configure step, set -DCMAKE_BUILD_TYPE=Debug
|
||||
--with-examples in configure step, set -DXO_ENABLE_EXAMPLES=1
|
||||
--with-utests in configure step, set -DENABLE_TESTING=1
|
||||
--debug-build in configure step, set -DCMAKE_BUILD_TYPE=Debug
|
||||
--with-opengl=FLAG in configure step, set -DXO_ENABLE_OPENGL=FLAG [ON]
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
cmd=
|
||||
noop_flag=0
|
||||
xoname=
|
||||
repo_flag=0
|
||||
clone_flag=0
|
||||
configure_flag=0
|
||||
build_flag=0
|
||||
build_docs_flag=0
|
||||
install_flag=0
|
||||
realclean_flag=0
|
||||
pathtosource=
|
||||
pathtobuild=
|
||||
with_examples=0
|
||||
with_utests=0
|
||||
debug_build=0
|
||||
with_opengl=
|
||||
|
||||
while [[ $# > 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue