summaryrefslogtreecommitdiff
path: root/plugins/warp/ui/CMakeLists.txt
blob: d95ea6a7e115782a4407f6646b07068c06e84904 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

project(warp_ui CXX C)

file(GLOB SOURCES CONFIGURE_DEPENDS
        plugin.cpp plugin.h
        matches.cpp matches.h
        matched.cpp matched.h
        shared/misc.cpp shared/misc.h
        shared/constraint.cpp shared/constraint.h
        shared/function.cpp shared/function.h
        containers.cpp containers.h
        shared/search.cpp shared/search.h
        shared/fetcher.cpp shared/fetcher.h
        shared/fetchdialog.cpp shared/fetchdialog.h
        shared/processordialog.cpp shared/processordialog.h
        shared/commitdialog.cpp shared/commitdialog.h
        shared/file.cpp shared/file.h
        shared/chunk.cpp shared/chunk.h
        shared/source.cpp shared/source.h
        shared/selectprojectfilesdialog.cpp shared/selectprojectfilesdialog.h)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)

if (DEMO)
    add_library(${PROJECT_NAME} STATIC ${SOURCES} ${MOCS})
else ()
    add_library(${PROJECT_NAME} SHARED ${SOURCES} ${MOCS})
endif ()

target_include_directories(${PROJECT_NAME} PRIVATE ../api)

if (NOT BN_API_BUILD_EXAMPLES AND NOT BN_INTERNAL_BUILD)
    # Out-of-tree build
    find_path(
            BN_API_PATH
            NAMES binaryninjaapi.h
            HINTS ../.. binaryninjaapi $ENV{BN_API_PATH}
            REQUIRED
    )
    add_subdirectory(${BN_API_PATH} api)
endif ()

target_link_libraries(${PROJECT_NAME} binaryninjaui warp_api Qt6::Core Qt6::Gui Qt6::Widgets)

set_target_properties(${PROJECT_NAME} PROPERTIES
        CXX_STANDARD 20
        CXX_VISIBILITY_PRESET hidden
        CXX_STANDARD_REQUIRED ON
        VISIBILITY_INLINES_HIDDEN ON
        POSITION_INDEPENDENT_CODE ON)

if (BN_INTERNAL_BUILD)
    ui_plugin_rpath(${PROJECT_NAME})

    if (UNIX)
        # A hack to get the ui plugin to find the warp core plugin.
        set_target_properties(${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH "$ORIGIN")
    endif()

    set_target_properties(${PROJECT_NAME} PROPERTIES
            LIBRARY_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR}
            RUNTIME_OUTPUT_DIRECTORY ${BN_CORE_PLUGIN_DIR})
else ()
    # TODO: There is a possibility that linux will fail to load the correct core warp.
    bn_install_plugin(${PROJECT_NAME})
endif ()