This commit is contained in:
Rosalie Wanders
2020-09-20 20:37:48 +02:00
parent 116da39c62
commit 754bc58a5b
7 changed files with 75 additions and 49 deletions
+12 -1
View File
@@ -6,14 +6,25 @@ toplvl_dir="$(realpath "$script_dir/../../")"
build_dir="$toplvl_dir/Build"
build_config="${1:-Debug}"
install_dir="$toplvl_dir/Bin/$build_config"
generator="${2:-Unix Makefiles}"
mkdir -p "$build_dir"
pushd "$build_dir"
cmake -S "$toplvl_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_config"
if [[ $(uname -s) = *MINGW64* ]]
then
generator="MSYS Makefiles"
fi
cmake -S "$toplvl_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_config" -G "$generator"
make -j6
make install DESTDIR="$install_dir"
if [[ $(uname -s) = *MINGW64* ]]
then
make bundle_dependencies
fi
popd
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
#
# ./BundleDependencies.sh "./Bin/Release/rmg/RMG.exe" "./Bin/Release/rmg" "/mingw64/bin"
#
set -e
exe="$1"
bin_dir="$2"
path="$3"
function copyForOBJ() {
local deps=`objdump.exe -p $1 | grep 'DLL Name:' | sed -e "s/\t*DLL Name: //g"`
while read -r line
do
findAndCopyDLL $line
done <<< "$deps"
}
function findAndCopyDLL() {
local file="$path/$1"
if [ -f $file ] && [ ! -f "$bin_dir/$1" ]
then
cp "$file" "$bin_dir"
copyForOBJ $file
return 0
fi
return 0
}
for ext in dll exe
do
while read -r file_line
do
echo "=> Copying dependencies for $file_line"
copyForOBJ "$file_line"
done < <(find "$bin_dir" -name "*.$ext")
done
windeployqt "$exe"