diff --git a/.gitignore b/.gitignore index fff1611f0cf0..fc2d8901aae1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ __pycache__/ # executable genai-toolbox -toolbox \ No newline at end of file +toolbox +toolbox.exe diff --git a/DEVELOPER.md b/DEVELOPER.md index 657936bbc8d1..5ac688249293 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -44,6 +44,42 @@ Before you begin, ensure you have the following: curl http://127.0.0.1:5000 ``` +#### Cross Compiling For Windows + +Most developers work in a Unix or Unix-like environment. + +Compiling for Windows requires the download of zig to provide a C and C++ +compiler. These instructions are for cross compiling from Linux x86 but +should work for macOS with small changes. + +1. Download zig for your platform. + ```bash + cd $HOME + curl -fL "https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz" -o zig.tar.xz + tar xf zig.tar.xz + ``` + This will create the directory $HOME/zig-x86_64-linux-0.15.2. You only need to do this once. + + If you are on macOS curl from https://ziglang.org/download/0.15.2/zig-x86_64-macos-0.15.2.tar.xz + or https://ziglang.org/download/0.15.2/zig-aarch64-macos-0.15.2.tar.xz. + +2. Change to your MCP Toolbox directory and run the following: + ```bash + cd $HOME/genai-toolbox + GOOS=windows \ + GOARCH=amd64 \ + CGO_ENABLED=1 \ + CC="$HOME/zig-x86_64-linux-0.15.2/zig cc -target x86_64-windows-gnu" \ + CXX="$HOME/zig-x86_64-linux-0.15.2/zig c++ -target x86_64-windows-gnu" \ + go build -o toolbox.exe + ``` + + If you are on macOS alter the path `zig-x86_64-linux-0.15.2` to the proper path + for your zig installation. + +Now the toolbox.exe file is ready to use. Transfer it to your windows machine and test it. + + ### Tool Naming Conventions This section details the purpose and conventions for MCP Toolbox's tools naming