-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·51 lines (44 loc) · 1.83 KB
/
build.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Build DazScriptServer plugin DLL.
#
# Usage:
# ./build.sh Build only
# ./build.sh --install Build and copy DLL to DAZ Studio plugins folder
#
# Required CMake variables (set in CMakeCache or passed via -D):
# DAZ_SDK_DIR Path to DAZStudio4.5+ SDK
#
# Optional:
# DAZ_STUDIO_EXE_DIR Path to DAZ Studio executable folder (needed for --install)
set -e
echo "DAZ_SDK_DIR: ${DAZ_SDK_DIR:-<not set>}"
echo "DAZ_STUDIO_EXE_DIR: ${DAZ_STUDIO_EXE_DIR:-<not set>}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/build"
# Locate cmake — check PATH first, then known location
if command -v cmake &>/dev/null; then
CMAKE=cmake
elif [ -f "/x/apps/CMake/bin/cmake.exe" ]; then
CMAKE="/x/apps/CMake/bin/cmake"
else
echo "Error: cmake not found. Add it to PATH or install it to X:/apps/CMake." >&2
exit 1
fi
# Build up common cmake -D flags from environment variables
CMAKE_FLAGS=()
[ -n "$DAZ_SDK_DIR" ] && CMAKE_FLAGS+=("-DDAZ_SDK_DIR=$DAZ_SDK_DIR")
[ -n "$DAZ_STUDIO_EXE_DIR" ] && CMAKE_FLAGS+=("-DDAZ_STUDIO_EXE_DIR=$DAZ_STUDIO_EXE_DIR")
# Configure if no cache exists yet, or if project files are missing (stale/failed configure)
if [ ! -f "$BUILD_DIR/CMakeCache.txt" ] || [ ! -f "$BUILD_DIR/ALL_BUILD.vcxproj" ]; then
echo "Running CMake configure..."
"$CMAKE" -B "$BUILD_DIR" -S "$SCRIPT_DIR" "${CMAKE_FLAGS[@]}"
fi
if [ "$1" = "--install" ]; then
echo "Building and installing to DAZ Studio plugins folder..."
"$CMAKE" -B "$BUILD_DIR" -S "$SCRIPT_DIR" "${CMAKE_FLAGS[@]}" -DINSTALL_TO_DAZ=ON
"$CMAKE" --build "$BUILD_DIR" --config Release
else
echo "Building..."
"$CMAKE" --build "$BUILD_DIR" --config Release
echo "Output: $BUILD_DIR/lib/Release/DazScriptServer.dll (copy to plugins/DazScriptServer/ in DAZ Studio folder)"
fi