Skip to content

Instantly share code, notes, and snippets.

@matcool
Last active July 8, 2024 17:30
Show Gist options
  • Save matcool/abb65ee59ded3766717c673014c3a2a7 to your computer and use it in GitHub Desktop.
Save matcool/abb65ee59ded3766717c673014c3a2a7 to your computer and use it in GitHub Desktop.

Guide for cross compiling Windows GD Mods on Linux

Requirements

  • clang & llvm (make sure you have clang-cl)
  • cmake (duh)
  • git

1. Setting up xwin

Install xwin, you can also just use one of the unknown-linux tarballs from the releases

Now decide where you want your splat folder to be (this is the folder with the windows sdk and msvc headers/libs). For this guide i'll be using ~/splat to refer to this directory

Now run this command to download and extract all the headers:

xwin --arch x86_64 --accept-license splat --include-debug-libs --output splat

2. Clone the toolchain

Clone the clang-msvc-sdk repo, which contains the cmake toolchain file. For this guide i'll be using ~/toolchain to refer to the directory of the repo

git clone https://github.com/matcool/clang-msvc-sdk.git toolchain

3. Building

Since configuring the toolchain requires a lot of enviroment vars, i'll be creating a bash script with them.

Run this in the directory of your own CMake project of course..

build.sh

# remember to actually set these..
export SPLAT_DIR=/home/mat/splat
export TOOLCHAIN=/home/mat/toolchain/clang-cl-msvc.cmake
export HOST_ARCH=x86_64

# you can also use `-G Ninja` here
cmake \
  -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
  -DCMAKE_BUILD_TYPE=Release \
  -B build
  
cmake --build build --config Release

additional notes

Apparently the newer msvc stls require clang 16+, at least i got an error with clang 15 :(

These were all the packages i had to install on ubuntu to get this to work

sudo apt install git cmake clang-17 clang-tools-17 lld-17
@matcool
Copy link
Author

matcool commented Jul 8, 2024

image I did try to compile using the script, but i get this error

this was an issue with xwin, get the newest version and run splat again

@matcool
Copy link
Author

matcool commented Jul 8, 2024

image yup I can't build mods too still. I was able to a few days after I posted my first comment but I can't anymore after 2.206

update ur geode imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment