Skip to content

Commit 912d691

Browse files
committed
Improvements for custom umodel.exe file name
- 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
1 parent 0336bc6 commit 912d691

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

.vs/CppProperties.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"intelliSenseMode": "windows-msvc-x86",
1616
"environments": [
1717
{
18-
"BuildOptions": ""
18+
"BuildOptions": "--exe umodel.exe"
1919
}
2020
]
2121
},
@@ -35,7 +35,7 @@
3535
"intelliSenseMode": "windows-msvc-x86",
3636
"environments": [
3737
{
38-
"BuildOptions": "--debug"
38+
"BuildOptions": "--debug --exe umodel.exe"
3939
}
4040
]
4141
},
@@ -54,7 +54,7 @@
5454
"intelliSenseMode": "windows-msvc-x64",
5555
"environments": [
5656
{
57-
"BuildOptions": "--64"
57+
"BuildOptions": "--64 --exe umodel.exe"
5858
}
5959
]
6060
},
@@ -74,7 +74,7 @@
7474
"intelliSenseMode": "windows-msvc-x64",
7575
"environments": [
7676
{
77-
"BuildOptions": "--64 --debug"
77+
"BuildOptions": "--64 --debug --exe umodel.exe"
7878
}
7979
]
8080
}

build.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22

33

4-
# Parse command line parameters
4+
# Parse the command line
5+
ExeName=
56

67
while [ "$1" ]; do
78
case "$1" in
@@ -26,13 +27,17 @@ while [ "$1" ]; do
2627
VC32TOOLS_OPTIONS="--64"
2728
shift
2829
;;
30+
--exe)
31+
ExeName=$2
32+
shift 2
33+
;;
2934
--file)
3035
# compile a single file from VSCode, should replace slashes
3136
single_file=${2//\\//}
3237
shift 2
3338
;;
3439
*)
35-
echo "Usage: build.sh [--debug] [--profile] [--vc <version>] [--64] [--file <cpp file>]"
40+
echo "Usage: build.sh [--debug] [--profile] [--vc <version>] [--64] [--exe <file.exe>] [--file <cpp file>]"
3641
exit
3742
;;
3843
esac
@@ -53,10 +58,12 @@ function SetupDefaultProject()
5358
project="UmodelTool/umodel"
5459
root="."
5560
render=1
56-
local ExeName="umodel"
57-
[ "$debug" ] && ExeName+="-debug"
58-
[ "$profile" ] && ExeName+="-profile"
59-
[ "$PLATFORM" == "vc-win64" ] && ExeName+="_64"
61+
if [ -z "$ExeName" ]; then
62+
ExeName="umodel"
63+
[ "$debug" ] && ExeName+="-debug"
64+
[ "$profile" ] && ExeName+="-profile"
65+
[ "$PLATFORM" == "vc-win64" ] && ExeName+="_64"
66+
fi
6067
GENMAKE_OPTIONS+=" EXE_NAME=$ExeName"
6168
}
6269

test.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Options:
1515
--nobuild prevent from umodel rebuilding
1616
--exe=<executable> do not build when overrided (useful for testing with older exe from svn)
1717
--<game> choose predefined game path; <game> = ut2|ut3|gow2 etc
18-
--debug build with -debug option
18+
--debug build with --debug option
1919
--profile build with --profile option
2020
--clip do not start umodel, copy the startup command to clipboard (Windows only)
2121
--help display this help message
@@ -282,6 +282,7 @@ for arg in "$@"; do # using quoted $@ will allow to correctly separate argument
282282
;;
283283
--64)
284284
buildopt=--64
285+
win64=1
285286
;;
286287
--nobuild)
287288
nobuild=1
@@ -293,9 +294,11 @@ for arg in "$@"; do # using quoted $@ will allow to correctly separate argument
293294
--debug)
294295
buildopt="$buildopt --debug"
295296
debugOpt=-debug
297+
debug=1
296298
;;
297299
--profile)
298300
buildopt="$buildopt --profile"
301+
profile=1
299302
;;
300303
--clip)
301304
launch_string_to_clipboard=1
@@ -318,7 +321,14 @@ done
318321

319322
# rebuild umodel when not desired opposite
320323
if [ -z "$nobuild" ]; then
321-
console_title "Building umodel ..."
324+
# compute the name of umodel executable, copy-paste of SetupDefaultProject() code from build.sh
325+
exe="umodel"
326+
[ "$debug" ] && exe+="-debug"
327+
[ "$profile" ] && exe+="-profile"
328+
[ "$win64" ] && exe+="_64"
329+
exe+=".exe"
330+
331+
console_title "Building $exe ..."
322332
./build.sh $buildopt || exit 1
323333
fi
324334

0 commit comments

Comments
 (0)