Skip to content

Commit

Permalink
Improvements for custom umodel.exe file name
Browse files Browse the repository at this point in the history
- build.sh: added --exe <filename> option to override automatically generated umodel executable file name
- test.sh: generating executable name in the same way as build.sh does, so script will launch the correct executable file]
- Visual Studio project: forcing umodel.exe file name for all configurations, as launch.vs.json seems doesn't have a possibility to override it
  • Loading branch information
gildor2 committed Jul 5, 2021
1 parent 0336bc6 commit 912d691
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .vs/CppProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"intelliSenseMode": "windows-msvc-x86",
"environments": [
{
"BuildOptions": ""
"BuildOptions": "--exe umodel.exe"
}
]
},
Expand All @@ -35,7 +35,7 @@
"intelliSenseMode": "windows-msvc-x86",
"environments": [
{
"BuildOptions": "--debug"
"BuildOptions": "--debug --exe umodel.exe"
}
]
},
Expand All @@ -54,7 +54,7 @@
"intelliSenseMode": "windows-msvc-x64",
"environments": [
{
"BuildOptions": "--64"
"BuildOptions": "--64 --exe umodel.exe"
}
]
},
Expand All @@ -74,7 +74,7 @@
"intelliSenseMode": "windows-msvc-x64",
"environments": [
{
"BuildOptions": "--64 --debug"
"BuildOptions": "--64 --debug --exe umodel.exe"
}
]
}
Expand Down
19 changes: 13 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash


# Parse command line parameters
# Parse the command line
ExeName=

while [ "$1" ]; do
case "$1" in
Expand All @@ -26,13 +27,17 @@ while [ "$1" ]; do
VC32TOOLS_OPTIONS="--64"
shift
;;
--exe)
ExeName=$2
shift 2
;;
--file)
# compile a single file from VSCode, should replace slashes
single_file=${2//\\//}
shift 2
;;
*)
echo "Usage: build.sh [--debug] [--profile] [--vc <version>] [--64] [--file <cpp file>]"
echo "Usage: build.sh [--debug] [--profile] [--vc <version>] [--64] [--exe <file.exe>] [--file <cpp file>]"
exit
;;
esac
Expand All @@ -53,10 +58,12 @@ function SetupDefaultProject()
project="UmodelTool/umodel"
root="."
render=1
local ExeName="umodel"
[ "$debug" ] && ExeName+="-debug"
[ "$profile" ] && ExeName+="-profile"
[ "$PLATFORM" == "vc-win64" ] && ExeName+="_64"
if [ -z "$ExeName" ]; then
ExeName="umodel"
[ "$debug" ] && ExeName+="-debug"
[ "$profile" ] && ExeName+="-profile"
[ "$PLATFORM" == "vc-win64" ] && ExeName+="_64"
fi
GENMAKE_OPTIONS+=" EXE_NAME=$ExeName"
}

Expand Down
14 changes: 12 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options:
--nobuild prevent from umodel rebuilding
--exe=<executable> do not build when overrided (useful for testing with older exe from svn)
--<game> choose predefined game path; <game> = ut2|ut3|gow2 etc
--debug build with -debug option
--debug build with --debug option
--profile build with --profile option
--clip do not start umodel, copy the startup command to clipboard (Windows only)
--help display this help message
Expand Down Expand Up @@ -282,6 +282,7 @@ for arg in "$@"; do # using quoted $@ will allow to correctly separate argument
;;
--64)
buildopt=--64
win64=1
;;
--nobuild)
nobuild=1
Expand All @@ -293,9 +294,11 @@ for arg in "$@"; do # using quoted $@ will allow to correctly separate argument
--debug)
buildopt="$buildopt --debug"
debugOpt=-debug
debug=1
;;
--profile)
buildopt="$buildopt --profile"
profile=1
;;
--clip)
launch_string_to_clipboard=1
Expand All @@ -318,7 +321,14 @@ done

# rebuild umodel when not desired opposite
if [ -z "$nobuild" ]; then
console_title "Building umodel ..."
# compute the name of umodel executable, copy-paste of SetupDefaultProject() code from build.sh
exe="umodel"
[ "$debug" ] && exe+="-debug"
[ "$profile" ] && exe+="-profile"
[ "$win64" ] && exe+="_64"
exe+=".exe"

console_title "Building $exe ..."
./build.sh $buildopt || exit 1
fi

Expand Down

0 comments on commit 912d691

Please sign in to comment.