Skip to content

Commit 2060680

Browse files
committed
Add unflatten workflow example C++ port
1 parent be8c0c0 commit 2060680

File tree

3 files changed

+497
-0
lines changed

3 files changed

+497
-0
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ add_subdirectory(breakpoint)
44
add_subdirectory(x86_extension)
55
add_subdirectory(workflows/inliner)
66
add_subdirectory(workflows/tailcall)
7+
add_subdirectory(workflows/unflatten)
78

89
# Personal+ UI plugins (headless UI binaries is a weird concept but I guess technically possible)
910
if(NOT HEADLESS)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
2+
3+
project(workflow_unflatten CXX)
4+
5+
file(GLOB SOURCES
6+
*.cpp
7+
*.c
8+
*.h)
9+
10+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
11+
12+
if(NOT BN_API_BUILD_EXAMPLES AND NOT BN_INTERNAL_BUILD)
13+
# Out-of-tree build
14+
find_path(
15+
BN_API_PATH
16+
NAMES binaryninjaapi.h
17+
HINTS ../../.. binaryninjaapi $ENV{BN_API_PATH}
18+
REQUIRED
19+
)
20+
add_subdirectory(${BN_API_PATH} api)
21+
endif()
22+
23+
target_link_libraries(${PROJECT_NAME} PUBLIC binaryninjaapi)
24+
25+
set_target_properties(${PROJECT_NAME} PROPERTIES
26+
CXX_STANDARD 20
27+
CXX_VISIBILITY_PRESET hidden
28+
CXX_STANDARD_REQUIRED ON
29+
C_STANDARD 99
30+
C_STANDARD_REQUIRED ON
31+
C_VISIBILITY_PRESET hidden
32+
VISIBILITY_INLINES_HIDDEN ON
33+
POSITION_INDEPENDENT_CODE ON)
34+
35+
if(BN_INTERNAL_BUILD)
36+
plugin_rpath(${PROJECT_NAME})
37+
set_target_properties(${PROJECT_NAME} PROPERTIES
38+
LIBRARY_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR}
39+
RUNTIME_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR})
40+
endif()

0 commit comments

Comments
 (0)