1# Copyright (c) 2022-2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14cmake_minimum_required(VERSION 3.10) 15 16project(arkinspector) 17 18set(ARKINSPECTOR_ROOTS 19 connection/endpoint_base.cpp 20 connection/event_loop.cpp 21 connection/server_endpoint_base.cpp 22 debugger/breakpoint.cpp 23 debugger/breakpoint_storage.cpp 24 debugger/conditional_breakpoint.cpp 25 debugger/debug_info_cache.cpp 26 debugger/debuggable_thread.cpp 27 debugger/object_repository.cpp 28 debugger/thread_state.cpp 29 error.cpp 30 evaluation/evaluation_engine.cpp 31 init.cpp 32 inspector.cpp 33 inspector_server.cpp 34 json_serialization/jrpc_error.cpp 35 session_manager.cpp 36 source_manager.cpp 37 types/custom_url_breakpoint_response.cpp 38 types/debugger_evaluation_request.cpp 39 types/debugger_call_function_on_request.cpp 40 types/exception_details.cpp 41 types/location.cpp 42 types/profile_result.cpp 43 types/remote_object.cpp 44 types/object_preview.cpp 45 types/scope.cpp 46 types/url_breakpoint_request.cpp 47 types/url_breakpoint_response.cpp 48) 49set(ARKINSPECTOR_LINKED_LIBRARIES 50 arkbase 51 arkdisassembler 52 arkfile 53 arkruntime 54) 55set(ARKINSPECTOR_DEFINITIONS 56 "" 57) 58 59# required for arkcompiler_toolchain compilation 60if(PANDA_TARGET_OHOS) 61 list(APPEND ARKINSPECTOR_DEFINITIONS -DOHOS_PLATFORM) 62endif() 63 64if(PANDA_TOOLING_ASIO) 65 list(APPEND ARKINSPECTOR_ROOTS 66 connection/asio/asio_server.cpp 67 connection/asio/ws_logger.cpp 68 ) 69 set(ARKINSPECTOR_INCLUDES 70 ${PANDA_THIRD_PARTY_SOURCES_DIR}/asio/asio/include/ 71 ${PANDA_THIRD_PARTY_SOURCES_DIR}/websocketpp/ 72 ) 73 list(APPEND ARKINSPECTOR_DEFINITIONS 74 -DPANDA_TOOLING_ASIO 75 -DASIO_NO_TYPEID 76 -DASIO_STANDALONE 77 ) 78else() 79 list(APPEND ARKINSPECTOR_ROOTS 80 connection/ohos_ws/ohos_ws_server_endpoint.cpp 81 connection/ohos_ws/ohos_ws_server.cpp 82 ) 83 list(APPEND ARKINSPECTOR_LINKED_LIBRARIES toolchain_websocket) 84 set(ARKINSPECTOR_INCLUDES 85 ${PANDA_THIRD_PARTY_SOURCES_DIR}/arkcompiler/toolchain/ 86 ${PANDA_ROOT}/runtime/tooling/ 87 ) 88endif() 89 90 91panda_add_library(${PROJECT_NAME} SHARED ${ARKINSPECTOR_ROOTS}) 92 93panda_target_compile_definitions(${PROJECT_NAME} PUBLIC ${ARKINSPECTOR_DEFINITIONS}) 94 95panda_target_compile_options(${PROJECT_NAME} PUBLIC -fexceptions -Wno-invalid-offsetof) 96 97add_dependencies(${PROJECT_NAME} arkruntime) 98 99panda_target_include_directories(${PROJECT_NAME} 100 PUBLIC ${PANDA_ROOT}/runtime/include/ 101 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} 102) 103 104panda_target_include_directories(${PROJECT_NAME} SYSTEM 105 PUBLIC ${ARKINSPECTOR_INCLUDES} 106) 107 108panda_target_link_libraries(${PROJECT_NAME} 109 ${ARKINSPECTOR_LINKED_LIBRARIES} 110) 111 112panda_add_sanitizers(TARGET ${PROJECT_NAME} SANITIZERS ${PANDA_SANITIZERS_LIST}) 113 114panda_add_gtest( 115 NAME arkinspector_tests 116 NO_CORES 117 SOURCES 118 tests/base64.cpp 119 tests/debug_info_cache.cpp 120 tests/inspector_server.cpp 121 tests/json_object_matcher.cpp 122 tests/object_repository.cpp 123 tests/session_manager.cpp 124 tests/source_manager.cpp 125 tests/thread_state.cpp 126 INCLUDE_DIRS 127 ${PANDA_ROOT}/runtime/tooling/inspector 128 LIBRARIES 129 arkassembler 130 ${PROJECT_NAME} 131 arkruntime 132 gmock 133 SANITIZERS 134 ${PANDA_SANITIZERS_LIST} 135) 136