From 7a368fa86b45271691bcb3219091a020aa023b82 Mon Sep 17 00:00:00 2001 From: Jacob Gamble Date: Tue, 5 May 2026 09:22:41 -0500 Subject: [PATCH] First pass windows build --- CMakeLists.txt | 16 ++++++++++++---- cmake/toolchains/x86_64-w64-mingw32.cmake | 19 +++++++++++++++++++ src/main.cpp | 8 +++++++- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 cmake/toolchains/x86_64-w64-mingw32.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f3bf90..78a3321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,16 +8,24 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(CURL REQUIRED) find_package(nlohmann_json REQUIRED) -add_library(drharness_lib - src/tool_registry.cpp - src/ollama_client.cpp - src/harness.cpp +set(TOOL_SOURCES tools/shell_tool.cpp tools/agent_tool.cpp tools/edit_tool.cpp tools/file_list_tool.cpp tools/file_read_tool.cpp ) + +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + list(REMOVE_ITEM TOOL_SOURCES tools/shell_tool.cpp) +endif() + +add_library(drharness_lib + src/tool_registry.cpp + src/ollama_client.cpp + src/harness.cpp + ${TOOL_SOURCES} +) target_include_directories(drharness_lib PUBLIC include tools) target_link_libraries(drharness_lib PUBLIC nlohmann_json::nlohmann_json diff --git a/cmake/toolchains/x86_64-w64-mingw32.cmake b/cmake/toolchains/x86_64-w64-mingw32.cmake new file mode 100644 index 0000000..a8b7df8 --- /dev/null +++ b/cmake/toolchains/x86_64-w64-mingw32.cmake @@ -0,0 +1,19 @@ +# cmake/toolchains/x86_64-w64-mingw32.cmake +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +# Use the mingw compilers directly +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) + +# Gentoo's mingw-w64 sysroot +set(CMAKE_SYSROOT /usr/x86_64-w64-mingw32/) + +# Configuration for pkg-config (helps find library libs) +set(PKG_CONFIG_EXECUTABLE x86_64-w64-mingw32-pkg-config) +set(PKG_CONFIG_LIBDIR /usr/x86_64-w64-mingw32/x86_64-w64-mingw32/lib/pkgconfig) + +# Strict system path lookup for cross-compiling +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/src/main.cpp b/src/main.cpp index d3596a7..01e2101 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,9 @@ #include "ollama_client.hpp" #include "tool_registry.hpp" #include "agent_profile.hpp" +#if !defined(_WIN32) #include "shell_tool.hpp" +#endif #include "agent_tool.hpp" #include "edit_tool.hpp" #include "file_list_tool.hpp" @@ -14,6 +16,7 @@ #include static const std::vector profiles = { +#if !defined(_WIN32) { .name = "shell_expert", .description = "An agent that can run shell commands to inspect the system, " @@ -21,6 +24,7 @@ static const std::vector profiles = { .model = "gemma4:26b", .tool_names = {"run_shell"} }, +#endif // Add more agent profiles here }; @@ -37,10 +41,12 @@ int main(int argc, char** argv) { ToolRegistry master_registery; ToolRegistry agent_tools; - master_registery.register_tool(make_shell_tool()); master_registery.register_tool(make_edit_tool()); master_registery.register_tool(make_file_list_tool()); master_registery.register_tool(make_file_read_tool()); +#if !defined(_WIN32) + master_registery.register_tool(make_shell_tool()); +#endif // Add more base tools here: for (const auto& profile : profiles)