mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 03:48:30 +01:00
Merge pull request #238 from gucio321/sh-generator-pass-cmdline-args
Sh generator: pass cmdline args
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# this script must be executed in this directory
|
# this script must be executed in this directory
|
||||||
# all the output goes to generator/output folder
|
# all the output goes to generator/output folder
|
||||||
@@ -16,10 +16,62 @@
|
|||||||
# arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation, comments for comments generation, nochar to skip char* function version, noimstrv to skip imstrv
|
# arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation, comments for comments generation, nochar to skip char* function version, noimstrv to skip imstrv
|
||||||
# examples: "" "internal" "internal freetype" "comments internal"
|
# examples: "" "internal" "internal freetype" "comments internal"
|
||||||
# arg[3..n] name of implementations to generate and/or CLFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
|
# arg[3..n] name of implementations to generate and/or CLFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
|
||||||
|
#
|
||||||
|
|
||||||
|
# parse command line arguments
|
||||||
|
# ref: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
||||||
|
POSITIONAL_ARGS=()
|
||||||
|
|
||||||
|
TARGETS="internal noimstrv"
|
||||||
|
CFLAGS="glfw opengl3 opengl2 sdl2"
|
||||||
|
|
||||||
|
help() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage of generator.sh:
|
||||||
|
-t --target specify which imgui features should be generated
|
||||||
|
(default: $TARGETS)
|
||||||
|
-c --cflags specify additional gcc flags
|
||||||
|
(default: $CFLAGS
|
||||||
|
-h --help show this message and exit
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-c|--cflags)
|
||||||
|
CFLAGS="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-t|--target)
|
||||||
|
TARGETS="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-*|--*)
|
||||||
|
echo "Unknown option $1"
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POSITIONAL_ARGS+=("$1") # save positional arg
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]];
|
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]];
|
||||||
then
|
then
|
||||||
suffix='.exe'
|
suffix='.exe'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
luajit$suffix ./generator.lua gcc "internal noimstrv" glfw opengl3 opengl2 sdl2 "$@"
|
echo "CFLAGS: " $CFLAGS
|
||||||
|
echo "TARGETS: " $TARGETS
|
||||||
|
|
||||||
|
luajit$suffix ./generator.lua gcc "$TARGETS" $CFLAGS
|
||||||
|
Reference in New Issue
Block a user