diff --git a/build/build.sh b/build/build.sh index 49b286b..96f5d84 100755 --- a/build/build.sh +++ b/build/build.sh @@ -4,15 +4,17 @@ export ANDROID_NDK_ROOT="$HOME/.android-sdk/ndk/23.2.8568313" # Folders _build_folder="gdextension" +_bin_folder="build" # Error variables _error_build_folder="${_build_folder} doesn't exist" +_error_bin_folder="${_bin_folder} doesn't exist" _error_no_option="\nYou have to indicate a valid option" # Platform variables -_platform_linux="platform=linux" -_platform_windows="platform=windows" -_platform_android="platform=android" +_platform_linux="linux" +_platform_windows="windows" +_platform_android="android" # Clean variables and exit function clean_exit() { @@ -28,8 +30,10 @@ function clean_exit() { unset _error_no_option unset _error_build_folder + unset _error_bin_folder unset _build_folder + unset _bin_folder unset ANDROID_NDK_ROOT exit "$1" @@ -38,19 +42,26 @@ function clean_exit() { # Clean compilations function clean() { cd "$_build_folder" || clean_exit 1 "$_error_build_folder" - scons "$_platform_linux" --clean - scons "$_platform_windows" --clean - scons "$_platform_android" --clean + scons "platform=$_platform_linux" --clean + scons "platform=$_platform_windows" --clean + scons "platform=$_platform_android" --clean cd .. } # Build by passing the platform as a variable function build() { cd "$_build_folder" || clean_exit 1 "$_error_build_folder" - scons "$1" target=template_release - scons "$1" target=template_debug - unset 1 + scons "platform=$1" target=template_release + scons "platform=$1" target=template_debug cd .. + + if [ "$1" != "$_platform_android" ]; then + cd "$_bin_folder" || clean_exit 1 "$_error_bin_folder" + strip ./*.$1.template_release.*.* + cd .. + fi + + unset 1 } # Analize build process to create compile_commands.json