Skip to content

Commit

Permalink
Use pre-generated API stubs to avoid requiring a Binary Ninja install
Browse files Browse the repository at this point in the history
This change includes a script that extracts all C API functions from the
Binary Ninja API and creates empty stub functions for them. This is later
compiled into an API compatible library that is used to link against. This
avoids having to use install a copy of Binary Ninja on the machine that builds
BinExport.

If an installation of Binary Ninja is available, then BinExport can be built
using that, too.

Note that the script can be replaced with a small Clang tool to make it more
robust should that become necessary.

PiperOrigin-RevId: 336267078
Change-Id: Id3b3db1b0f0212a3c9318ca8f7deb100dc81bdc3
  • Loading branch information
cblichmann authored and Copybara-Service committed Oct 9, 2020
1 parent 0a99d69 commit bed74c1
Show file tree
Hide file tree
Showing 3 changed files with 5,750 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Expand Up @@ -349,11 +349,13 @@ ida_install(TARGETS ${binexport_ida_plugin_name}
# Binary Ninja plugin (beta)
if(BinaryNinjaApi_FOUND OR BinaryNinjaApi_ROOT_DIR)
if(BinaryNinjaApi_ROOT_DIR)
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/binaryninjacore_empty.cc")
add_library(binaryninjacore_empty STATIC
"${CMAKE_CURRENT_BINARY_DIR}/binaryninjacore_empty.cc"
add_library(binaryninjacore SHARED
third_party/binaryninja_api/binaryninjacore.cc
)
set(BN_CORE_LIBRARY binaryninjacore_empty)
target_include_directories(binaryninjacore PRIVATE
${BinaryNinjaApi_INCLUDE_DIRS}
)
set(BN_CORE_LIBRARY binaryninjacore)

add_subdirectory("${BinaryNinjaApi_ROOT_DIR}"
"${CMAKE_BINARY_DIR}/binaryninja-api-build"
Expand Down

0 comments on commit bed74c1

Please sign in to comment.