54 lines
2.2 KiB
Makefile
54 lines
2.2 KiB
Makefile
xwin_version := '0.2.12'
|
|
xwin_prefix := 'xwin-' + xwin_version + '-x86_64-unknown-linux-musl'
|
|
|
|
export WINEPREFIX := justfile_directory() + "/.wineprefix"
|
|
export WINEDEBUG := '-all'
|
|
|
|
# Note that we only disable unused-command-line-argument here since clang-cl
|
|
# doesn't implement all of the options supported by cl, but the ones it doesn't
|
|
# are _generally_ not interesting.
|
|
CL_FLAGS := "-Wno-unused-command-line-argument -fuse-ld=lld-link ./msvc/crt/include ./msvc/sdk/include/ucrt ./msvc/sdk/include/um ./msvc/sdk/include/shared"
|
|
|
|
export CC_x86_64_pc_windows_msvc := "clang-cl"
|
|
export CXX_x86_64_pc_windows_msvc := "clang-cl"
|
|
export AR_x86_64_pc_windows_msvc := "llvm-lib"
|
|
# Use wine to run test executables
|
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER := "wine"
|
|
# Let cargo know what linker to invoke if you haven't already specified it
|
|
# in a .cargo/config.toml file
|
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER := "lld-link"
|
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS := "-Lnative=./msvc/crt/lib/x86_64 -Lnative=./msvc/sdk/lib/um/x86_64 -Lnative=./msvc/sdk/lib/ucrt/x86_64"
|
|
export CFLAGS_x86_64_pc_windows_msvc := CL_FLAGS
|
|
export CXXFLAGS_x86_64_pc_windows_msvc := CL_FLAGS
|
|
|
|
default: build
|
|
|
|
build: start-wineserver
|
|
cargo build -Zbuild-std --target x86_64-pc-windows-msvc
|
|
[ -d "$game_dir" ] && cp ./target/x86_64-pc-windows-msvc/debug/dt_p2p.dll "$game_dir/binaries/plugins/dt_p2p_debug_pluginw64_release.dll"
|
|
|
|
[no-exit-message]
|
|
wine *ARGS:
|
|
@wine {{ ARGS }}
|
|
|
|
start-wineserver:
|
|
#!/bin/sh
|
|
set -eu
|
|
|
|
bold=$(tput bold)
|
|
normal=$(tput sgr0)
|
|
|
|
mkdir -p "$WINEPREFIX"
|
|
if ! pgrep wineserver >/dev/null; then
|
|
echo "${bold}wineserver -p${normal}"
|
|
wineserver -p
|
|
echo "${bold}wine wineboot --init --update${normal}"
|
|
wine wineboot --init --update
|
|
fi
|
|
|
|
setup-msvc:
|
|
rustup target add x86_64-pc-windows-msvc
|
|
rustup component add rust-src
|
|
mkdir -p ./tools
|
|
curl --fail -L https://github.com/Jake-Shadle/xwin/releases/download/{{ xwin_version }}/{{ xwin_prefix }}.tar.gz | tar -xzv -C ./tools --strip-components=1 {{ xwin_prefix }}/xwin
|
|
./tools/xwin --accept-license splat --include-debug-libs --output ./msvc
|