diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6fb97a..0968e68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,12 +19,15 @@ jobs: - os: ubuntu-latest artifact: linux-x64 binary: build/ida_plugins/ida_discord_rpc.so + cmake_args: '' - os: windows-latest artifact: windows-x64 binary: build/ida_plugins/ida_discord_rpc.dll + cmake_args: '' - os: macos-latest - artifact: macos-x64 + artifact: macos-universal binary: build/ida_plugins/ida_discord_rpc.dylib + cmake_args: '-DCMAKE_OSX_ARCHITECTURES=arm64' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -41,10 +44,28 @@ jobs: - if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - - run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release + - run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_args }} - run: cmake --build build + - if: runner.os == 'macOS' + run: | + cmake -S . -B build-x64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 + cmake --build build-x64 + lipo -create \ + build/ida_plugins/ida_discord_rpc.dylib \ + build-x64/ida_plugins/ida_discord_rpc.dylib \ + -output ida_discord_rpc-universal.dylib + mv ida_discord_rpc-universal.dylib build/ida_plugins/ida_discord_rpc.dylib + archs=$(lipo -archs build/ida_plugins/ida_discord_rpc.dylib) + echo "universal dylib architectures: $archs" + for want in arm64 x86_64; do + case " $archs " in + *" $want "*) ;; + *) echo "::error::missing $want slice in universal dylib"; exit 1 ;; + esac + done + - uses: actions/upload-artifact@v4 with: name: ida_discord_rpc-${{ matrix.artifact }} @@ -71,7 +92,7 @@ jobs: cp assets/ida-discord.png pkg/assets/ cp dist/ida_discord_rpc-linux-x64/ida_discord_rpc.so pkg/ cp dist/ida_discord_rpc-windows-x64/ida_discord_rpc.dll pkg/ - cp dist/ida_discord_rpc-macos-x64/ida_discord_rpc.dylib pkg/ + cp dist/ida_discord_rpc-macos-universal/ida_discord_rpc.dylib pkg/ cd pkg && zip -r "../ida_discord_rpc-${GITHUB_REF_NAME}.zip" . && cd .. unzip -l ida_discord_rpc-*.zip diff --git a/cmake/FindIdaSDK.cmake b/cmake/FindIdaSDK.cmake index f83eb20..9cca7ae 100644 --- a/cmake/FindIdaSDK.cmake +++ b/cmake/FindIdaSDK.cmake @@ -3,7 +3,18 @@ if(WIN32) set(_idasdk_libdir "x64_win_vc_64") set(_idasdk_platform_def "__NT__") elseif(APPLE) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64") + set(_idasdk_mac_arch "${CMAKE_SYSTEM_PROCESSOR}") + if(CMAKE_OSX_ARCHITECTURES) + list(LENGTH CMAKE_OSX_ARCHITECTURES _idasdk_mac_arch_count) + if(_idasdk_mac_arch_count GREATER 1) + message(FATAL_ERROR + "The IDA SDK ships a separate import library per macOS architecture, " + "so a multi-architecture build cannot link. Configure one build tree " + "per architecture and merge the resulting dylibs with lipo.") + endif() + set(_idasdk_mac_arch "${CMAKE_OSX_ARCHITECTURES}") + endif() + if(_idasdk_mac_arch MATCHES "arm64|aarch64") set(_idasdk_libdir "arm64_mac_clang_64") else() set(_idasdk_libdir "x64_mac_clang_64") @@ -75,6 +86,8 @@ endif() mark_as_advanced(IdaSDK_INCLUDE_DIR IdaSDK_LIBRARY) +unset(_idasdk_mac_arch) +unset(_idasdk_mac_arch_count) unset(_idasdk_libdir) unset(_idasdk_platform_def) unset(_idasdk_hints) diff --git a/ida-plugin.json b/ida-plugin.json index 0df94cb..92b7aff 100644 --- a/ida-plugin.json +++ b/ida-plugin.json @@ -6,7 +6,7 @@ "entryPoint": "ida_discord_rpc", "version": "1.1.0", "idaVersions": ["9.0", "9.1", "9.2", "9.3", "9.4"], - "platforms": ["windows-x86_64", "linux-x86_64", "macos-x86_64"], + "platforms": ["windows-x86_64", "linux-x86_64", "macos-x86_64", "macos-aarch64"], "description": "IDA Discord RPC integrates Discord Rich Presence into IDA, displaying real-time information about your reverse engineering activity directly in your Discord profile: current function, view, file, debugging status and more - all configurable from a settings dialog.", "license": "Apache-2.0", "logoPath": "assets/ida-discord.png", diff --git a/readme.md b/readme.md index 1d38e11..37ed343 100644 --- a/readme.md +++ b/readme.md @@ -22,6 +22,42 @@ IDA Discord RPC is a plugin for IDA that displays your current activity as Disco ## Installation +### Using HCLI (recommended) + +The plugin ships [IDA plugin metadata](ida-plugin.json), so the [Hex-Rays CLI](https://hcli.docs.hex-rays.com/) plugin manager can install it, place the right binary for your platform and keep it updated: + +```bash +hcli plugin install IDA-Discord-RPC@https://github.com/reversedcodes/IDA-RPC +``` + +Once the plugin is listed in the Hex-Rays plugin repository, the short form works as well: + +```bash +hcli plugin install IDA-Discord-RPC +``` + +Managing the installation: + +```bash +hcli plugin status +hcli plugin upgrade IDA-Discord-RPC +hcli plugin uninstall IDA-Discord-RPC +``` + +If HCLI is not installed yet, on macOS and Linux: + +```bash +curl -LsSf https://hcli.docs.hex-rays.com/install | sh +``` + +On Windows, in PowerShell: + +```powershell +iwr -useb https://hcli.docs.hex-rays.com/install.ps1 | iex +``` + +### Manual + Download the ZIP from the [latest release](https://github.com/reversedcodes/IDA-RPC/releases) and copy the binary for your OS into your IDA plugins directory: | OS | Plugins directory |