Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ohos): hippy support ohos #4176

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ framework/voltron/VoltronCore/VoltronCore.xcodeproj/project.xcworkspace
framework/voltron/VoltronCore/VoltronCore.xcodeproj/xcuserdata/

renderer/voltron/core/lib/

.hvigor/
oh_modules/*
oh-package-lock.json5
.clang-format
.clang-tidy
.clangd
BuildProfile.ets
10 changes: 10 additions & 0 deletions AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "com.tencent.hippydemo",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
8 changes: 8 additions & 0 deletions AppScope/resources/base/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "HippyDemo"
}
]
}
Binary file added AppScope/resources/base/media/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"app": {
"products": [
{
"name": "default",
"signingConfig": "default",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS"
}
],
"buildModeSet": [
{
"name": "debug",
"buildOption": {
"externalNativeOptions": {
"abiFilters": [
"arm64-v8a"
]
}
}
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry_har",
"srcPath": "./framework/examples/ohos-har-demo",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "entry",
"srcPath": "./framework/examples/ohos-demo",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "hippy",
"srcPath": "./framework/ohos"
},
]
}
7 changes: 7 additions & 0 deletions buildconfig/cmake/GlobalPackagesModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ function(GlobalPackages_Add_jni)
endif()
endfunction()

function(GlobalPackages_Add_oh_napi)
if (NOT TARGET oh_napi)
InfraPackage_Add(OH_NAPI
LOCAL "${PROJECT_ROOT_DIR}/modules/ohos/oh_napi")
endif()
endfunction()

function(GlobalPackages_Add_vfs)
if (NOT TARGET vfs)
InfraPackage_Add(VFS
Expand Down
6 changes: 5 additions & 1 deletion devtools/devtools-backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ endif ()
# endregion

# region footstone
GlobalPackages_Add(footstone)
if (OHOS)
GlobalPackages_Add_footstone()
else ()
GlobalPackages_Add(footstone)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE footstone)
# endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@

#include <string>
#include <vector>
// nlohmann/json.hpp:3177:30: error: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated]
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#include "nlohmann/json.hpp"
#pragma clang diagnostic pop

namespace hippy::devtools {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#pragma once
#pragma clang diagnostic ignored "-Wdeprecated"

#include <string>
#include "nlohmann/json.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#pragma once

#include <endian.h>
#include <netinet/in.h>
#include <functional>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions devtools/devtools-backend/src/tunnel/tcp/tcp_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "tunnel/tcp/tcp_channel.h"
#include <arpa/inet.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
#include <thread>
Expand Down
3 changes: 3 additions & 0 deletions devtools/devtools-integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ elseif (ANDROID)
add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/android/src/main/cpp)
elseif (IOS)
add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/ios)
elseif (OHOS)
add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/ohos)
endif()

24 changes: 20 additions & 4 deletions devtools/devtools-integration/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,38 @@ endif ()
# endregion

# region footstone
GlobalPackages_Add(footstone)
if (OHOS)
GlobalPackages_Add_footstone()
else ()
GlobalPackages_Add(footstone)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE footstone)
# endregion

# region vfs
GlobalPackages_Add(vfs)
if (OHOS)
GlobalPackages_Add_vfs()
else ()
GlobalPackages_Add(vfs)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE vfs)
# endregion

# region dom
GlobalPackages_Add(dom)
if (OHOS)
GlobalPackages_Add_dom()
else ()
GlobalPackages_Add(dom)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE dom)
# endregion

# region devtools
GlobalPackages_Add(devtools_backend)
if (OHOS)
GlobalPackages_Add_devtools_backend()
else ()
GlobalPackages_Add(devtools_backend)
endif ()
target_link_libraries(${PROJECT_NAME} PRIVATE devtools_backend)
# endregion

Expand Down
73 changes: 73 additions & 0 deletions devtools/devtools-integration/ohos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# Tencent is pleased to support the open source community by making
# Hippy available.
#
# Copyright (C) 2022 THL A29 Limited, a Tencent company.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

cmake_minimum_required(VERSION 3.14)

project("devtools_integration")

get_filename_component(PROJECT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../" REALPATH)

include("${PROJECT_ROOT_DIR}/buildconfig/cmake/InfraPackagesModule.cmake")
include("${PROJECT_ROOT_DIR}/buildconfig/cmake/compiler_toolchain.cmake")

set(CMAKE_CXX_STANDARD 17)

# region library
add_library(${PROJECT_NAME} STATIC)
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
# endregion

# region jni
GlobalPackages_Add_oh_napi()
target_link_libraries(${PROJECT_NAME} PUBLIC oh_napi)
# endregion

# region footstone
GlobalPackages_Add_footstone()
target_link_libraries(${PROJECT_NAME} PRIVATE footstone)
# endregion

# region dom
GlobalPackages_Add_dom()
target_link_libraries(${PROJECT_NAME} PRIVATE dom)
# endregion

# region vfs
GlobalPackages_Add_vfs()
target_link_libraries(${PROJECT_NAME} PRIVATE vfs)
# endregion

# region devtools
GlobalPackages_Add_devtools_backend()
target_link_libraries(${PROJECT_NAME} PRIVATE devtools_backend)
# endregion

# region devtools_integration
add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/native ${CMAKE_CURRENT_BINARY_DIR}/devtools-integration/native)
target_link_libraries(${PROJECT_NAME} PUBLIC devtools_integration_native)
# endregion

# region source set
set(SOURCE_SET
src/devtools_napi.cc)

target_sources(${PROJECT_NAME} PUBLIC ${SOURCE_SET})
# endregion
32 changes: 32 additions & 0 deletions devtools/devtools-integration/ohos/include/devtools_napi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Tencent is pleased to support the open source community by making
* Hippy available.
*
* Copyright (C) 2022 THL A29 Limited, a Tencent company.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include "footstone/string_view.h"
#include "footstone/task_runner.h"
#include <js_native_api.h>
#include <js_native_api_types.h>

namespace hippy::devtools {


}

Loading
Loading