Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 14 additions & 167 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ concurrency:
cancel-in-progress: true

jobs:
# ============================================================================
# Build (CLI + Plugin)
# ============================================================================
build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
Expand All @@ -35,7 +32,7 @@ jobs:
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_AI_AGENT=ON -DIDASQL_BUILD_EXAMPLES=ON
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_MCP=OFF -DIDASQL_BUILD_EXAMPLES=ON

- name: Build
run: cmake --build build --config Release
Expand Down Expand Up @@ -68,7 +65,7 @@ jobs:
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_AI_AGENT=ON -DIDASQL_BUILD_EXAMPLES=ON
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_MCP=OFF -DIDASQL_BUILD_EXAMPLES=ON

- name: Build
run: cmake --build build --config Release
Expand Down Expand Up @@ -103,7 +100,7 @@ jobs:
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DIDASQL_WITH_AI_AGENT=ON -DIDASQL_BUILD_EXAMPLES=ON
run: cmake -B build -DIDASQL_WITH_MCP=OFF -DIDASQL_BUILD_EXAMPLES=ON

- name: Build
run: cmake --build build --config Release
Expand All @@ -120,117 +117,10 @@ jobs:
name: cli-windows
path: ${{ env.IDASDK }}/src/bin/idasql.exe

# ============================================================================
# Build no-agent variant (CLI + Plugin) — lightweight HTTP-only, no AI deps
# ============================================================================
build-linux-no-agent:
name: Build no-agent (Linux)
runs-on: ubuntu-latest
env:
IDASDK: ${{ github.workspace }}/ida-sdk
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Setup IDA SDK
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_AI_AGENT=OFF

- name: Build
run: cmake --build build --config Release

- name: Upload plugin (no-agent)
uses: actions/upload-artifact@v4
with:
name: plugin-no-agent-linux
path: ${{ env.IDASDK }}/src/bin/plugins/idasql.so

- name: Upload CLI (no-agent)
uses: actions/upload-artifact@v4
with:
name: cli-no-agent-linux
path: ${{ env.IDASDK }}/src/bin/idasql

build-macos-no-agent:
name: Build no-agent (macOS)
runs-on: macos-latest
env:
IDASDK: ${{ github.workspace }}/ida-sdk
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Setup IDA SDK
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DIDASQL_WITH_AI_AGENT=OFF

- name: Build
run: cmake --build build --config Release

- name: Upload plugin (no-agent)
uses: actions/upload-artifact@v4
with:
name: plugin-no-agent-macos
path: ${{ env.IDASDK }}/src/bin/plugins/idasql.dylib

- name: Upload CLI (no-agent)
uses: actions/upload-artifact@v4
with:
name: cli-no-agent-macos
path: ${{ env.IDASDK }}/src/bin/idasql

build-windows-no-agent:
name: Build no-agent (Windows)
runs-on: windows-latest
env:
IDASDK: ${{ github.workspace }}/ida-sdk
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive

- name: Setup IDA SDK
shell: bash
run: git clone --depth 1 --recurse-submodules https://github.com/HexRaysSA/ida-sdk ida-sdk

- name: Configure
run: cmake -B build -DIDASQL_WITH_AI_AGENT=OFF

- name: Build
run: cmake --build build --config Release

- name: Upload plugin (no-agent)
uses: actions/upload-artifact@v4
with:
name: plugin-no-agent-windows
path: ${{ env.IDASDK }}/src/bin/plugins/idasql.dll

- name: Upload CLI (no-agent)
uses: actions/upload-artifact@v4
with:
name: cli-no-agent-windows
path: ${{ env.IDASDK }}/src/bin/idasql.exe

# ============================================================================
# Release
# ============================================================================
publish-release:
name: Publish Release
if: startsWith(github.ref, 'refs/tags/')
needs: [build-linux, build-macos, build-windows, build-linux-no-agent, build-macos-no-agent, build-windows-no-agent]
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -243,89 +133,48 @@ jobs:
path: plugins
merge-multiple: true

- name: Download CLI (with agent)
- name: Download CLI (Linux)
uses: actions/download-artifact@v4
with:
name: cli-linux
path: cli-linux
- uses: actions/download-artifact@v4
with:
name: cli-macos
path: cli-macos
- uses: actions/download-artifact@v4
with:
name: cli-windows
path: cli-windows

- name: Download no-agent plugins
- name: Download CLI (macOS)
uses: actions/download-artifact@v4
with:
pattern: plugin-no-agent-*
path: plugins-no-agent
merge-multiple: true
name: cli-macos
path: cli-macos

- name: Download CLI (no agent)
- name: Download CLI (Windows)
uses: actions/download-artifact@v4
with:
name: cli-no-agent-linux
path: cli-no-agent-linux
- uses: actions/download-artifact@v4
with:
name: cli-no-agent-macos
path: cli-no-agent-macos
- uses: actions/download-artifact@v4
with:
name: cli-no-agent-windows
path: cli-no-agent-windows
name: cli-windows
path: cli-windows

- name: Prepare release
run: |
mkdir -p release/plugin release/plugin-no-agent
mkdir -p release/plugin
mkdir -p release/cli/{windows,linux,macos}
mkdir -p release/cli-no-agent/{windows,linux,macos}
# Plugin with agent (flat, IDA-compatible)
cp plugins/idasql.dll release/plugin/ || true
cp plugins/idasql.so release/plugin/ || true
cp plugins/idasql.dylib release/plugin/ || true
cp ida-plugin.json release/plugin/
# Plugin without agent (flat, IDA-compatible)
cp plugins-no-agent/idasql.dll release/plugin-no-agent/ || true
cp plugins-no-agent/idasql.so release/plugin-no-agent/ || true
cp plugins-no-agent/idasql.dylib release/plugin-no-agent/ || true
cp ida-plugin.json release/plugin-no-agent/
# CLI with agent (organized by platform)
cp cli-windows/idasql.exe release/cli/windows/ || true
cp cli-linux/idasql release/cli/linux/ || true
cp cli-macos/idasql release/cli/macos/ || true
# CLI without agent (organized by platform)
cp cli-no-agent-windows/idasql.exe release/cli-no-agent/windows/ || true
cp cli-no-agent-linux/idasql release/cli-no-agent/linux/ || true
cp cli-no-agent-macos/idasql release/cli-no-agent/macos/ || true
echo "=== Plugin ===" && ls -la release/plugin/
echo "=== Plugin (no-agent) ===" && ls -la release/plugin-no-agent/
echo "=== CLI (agent) ===" && ls -laR release/cli/
echo "=== CLI (no-agent) ===" && ls -laR release/cli-no-agent/
echo "=== CLI ===" && ls -laR release/cli/

- name: Create plugin zip
run: |
cd release/plugin
zip -9 ../idasql_plugin-${{ github.ref_name }}.zip *

- name: Create plugin zip (no agent)
run: |
cd release/plugin-no-agent
zip -9 ../idasql_plugin-no-agent-${{ github.ref_name }}.zip *

- name: Create CLI zip (with agent)
- name: Create CLI zip
run: |
cd release/cli
zip -r9 ../idasql_cli-${{ github.ref_name }}.zip windows linux macos

- name: Create CLI zip (no agent)
run: |
cd release/cli-no-agent
zip -r9 ../idasql_cli-no-agent-${{ github.ref_name }}.zip windows linux macos

- name: Create Release
uses: softprops/action-gh-release@v2
with:
Expand All @@ -334,6 +183,4 @@ jobs:
generate_release_notes: true
files: |
release/idasql_plugin-${{ github.ref_name }}.zip
release/idasql_plugin-no-agent-${{ github.ref_name }}.zip
release/idasql_cli-${{ github.ref_name }}.zip
release/idasql_cli-no-agent-${{ github.ref_name }}.zip
93 changes: 26 additions & 67 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project(idasql VERSION 0.0.7 LANGUAGES C CXX)
project(idasql LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -69,76 +69,35 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/include)

# ============================================================================
# AI Agent Support (libagents - optional)
# MCP Support (optional)
# ============================================================================

option(IDASQL_WITH_AI_AGENT "Build with AI agent support (libagents)" ON)

if(IDASQL_WITH_AI_AGENT)
message(STATUS "idasql: Building with AI agent support via libagents")

# Prompt header generation is required when AI agent support is enabled.
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(PROMPT_MD "${CMAKE_CURRENT_SOURCE_DIR}/prompts/idasql_agent.md")
set(IDASQL_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "")
set(PROMPT_HPP "${IDASQL_GENERATED_INCLUDE_DIR}/idasql_agent_prompt.hpp")

file(MAKE_DIRECTORY ${IDASQL_GENERATED_INCLUDE_DIR})

add_custom_command(
OUTPUT ${PROMPT_HPP}
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/scripts/embed_prompt.py
${PROMPT_MD} ${PROMPT_HPP}
DEPENDS ${PROMPT_MD}
COMMENT "Checking/regenerating idasql_agent_prompt.hpp"
)
add_custom_target(generate_prompt DEPENDS ${PROMPT_HPP})

# libagents build options
set(LIBAGENTS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(LIBAGENTS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(LIBAGENTS_BUILD_CLI OFF CACHE BOOL "" FORCE)
set(LIBAGENTS_BUILD_COPILOT ON CACHE BOOL "" FORCE)

# FetchContent from GitHub (with recursive submodules for fastmcpp, SDKs)
message(STATUS "idasql: Fetching libagents from GitHub...")
FetchContent_Declare(libagents
GIT_REPOSITORY https://github.com/0xeb/libagents.git
GIT_TAG ae162192d49126da6328254aab73417d673379cc
GIT_SUBMODULES_RECURSE TRUE
)
FetchContent_MakeAvailable(libagents)

# ========================================================================
# Build speed: enable MSVC parallel compilation for dependency targets.
# IDA SDK's /MP only applies to ida_add_plugin/ida_add_idalib targets;
# FetchContent dependencies compile their files sequentially without this.
# ========================================================================
if(MSVC)
foreach(_dep_target fastmcpp_core copilot_sdk_cpp claude_sdk libagents)
if(TARGET ${_dep_target})
target_compile_options(${_dep_target} PRIVATE /MP)
endif()
endforeach()
option(IDASQL_WITH_MCP "Build with MCP server support (fastmcpp)" OFF)

if(IDASQL_WITH_MCP)
message(STATUS "idasql: Building with MCP support via fastmcpp")

# Reuse an existing fastmcpp target when available in a parent build.
if(NOT TARGET fastmcpp_core)
# Keep the dependency surface minimal for idasql.
set(FASTMCPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(FASTMCPP_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(FASTMCPP_ENABLE_POST_STREAMING OFF CACHE BOOL "" FORCE)
set(FASTMCPP_ENABLE_SAMPLING_HTTP_HANDLERS OFF CACHE BOOL "" FORCE)
set(FASTMCPP_FETCH_CURL OFF CACHE BOOL "" FORCE)

message(STATUS "idasql: Fetching fastmcpp from GitHub...")
FetchContent_Declare(fastmcpp
GIT_REPOSITORY https://github.com/0xeb/fastmcpp.git
GIT_TAG 4837e8e0a27d0011b73643fe02b3553cd3935c34
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(fastmcpp)
endif()

# Build speed: merge translation units to reduce header re-parsing.
# Note: fastmcpp_core is excluded — its server files use duplicate
# anonymous-namespace symbols that conflict under unity builds.
foreach(_dep_target copilot_sdk_cpp claude_sdk libagents)
if(TARGET ${_dep_target})
set_target_properties(${_dep_target} PROPERTIES UNITY_BUILD ON)
endif()
endforeach()

# Exclude unused targets from default build (e.g. claude-sdk debug tool)
foreach(_unused_target debug)
if(TARGET ${_unused_target})
set_target_properties(${_unused_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
endforeach()

if(MSVC AND TARGET fastmcpp_core)
target_compile_options(fastmcpp_core PRIVATE /MP)
endif()
endif()

# Add subdirectories
Expand Down
13 changes: 1 addition & 12 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,7 @@
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"IDASQL_WITH_AI_AGENT": "ON"
}
},
{
"name": "release-no-agent",
"displayName": "Release (no AI agent)",
"description": "Build without AI agent support to reduce binary size. Excludes libagents, fastmcpp, claude_sdk, copilot_sdk_cpp, easywsclient, tiny-process-library.",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build-no-agent",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"IDASQL_WITH_AI_AGENT": "OFF"
"IDASQL_WITH_MCP": "OFF"
}
}
]
Expand Down
Loading