Add support for building different components of the library
This commit is contained in:
parent
716c8238a7
commit
df65850678
38
compile
38
compile
@ -1,6 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
BUILD_TYPE="debug"
|
BUILD_TYPE="debug"
|
||||||
|
COMPONENTS="all"
|
||||||
|
|
||||||
|
function join_array {
|
||||||
|
DELIM="$1"
|
||||||
|
shift
|
||||||
|
local IFS="$DELIM"
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
SUPPORTED_COMPONENTS=("all" "testing" "os" "core")
|
||||||
|
COMPONENTS_STRING="$(join_array "|" ${SUPPORTED_COMPONENTS[@]})"
|
||||||
|
|
||||||
while [[ $# > 0 ]];do
|
while [[ $# > 0 ]];do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -8,8 +19,14 @@ while [[ $# > 0 ]];do
|
|||||||
BUILD_TYPE="release"
|
BUILD_TYPE="release"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--components)
|
||||||
|
COMPONENTS="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*|-*|--*)
|
*|-*|--*)
|
||||||
echo "Unknown option $1"
|
echo "Unknown option $1"
|
||||||
|
echo "Usage: $0 [--release] [--components $COMPONENTS_STRING (Default: all)]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -25,7 +42,26 @@ if [[ $CC == "gcc" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ")"
|
INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ")"
|
||||||
SRC="$(find src -type f -name "*.c" | xargs -I{} echo -n "{} ")"
|
|
||||||
|
case $COMPONENTS in
|
||||||
|
all)
|
||||||
|
SRC="src/wapp.c"
|
||||||
|
;;
|
||||||
|
testing)
|
||||||
|
SRC="src/testing/wapp_testing.c"
|
||||||
|
;;
|
||||||
|
os)
|
||||||
|
SRC="src/os/wapp_os.c"
|
||||||
|
;;
|
||||||
|
core)
|
||||||
|
SRC="src/core/wapp_core.c"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognised option for components: $COMPONENTS"
|
||||||
|
echo "Accepted options: $COMPONENTS_STRING"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
TEST_INCLUDE="$(find tests -type d | xargs -I{} echo -n "-I{} ")"
|
TEST_INCLUDE="$(find tests -type d | xargs -I{} echo -n "-I{} ")"
|
||||||
TEST_SRC="$(find tests -type f -name "*.c" | xargs -I{} echo -n "{} ")"
|
TEST_SRC="$(find tests -type f -name "*.c" | xargs -I{} echo -n "{} ")"
|
||||||
|
Loading…
Reference in New Issue
Block a user