Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/platform/vsgharmony/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "com.example.vsgharmony",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:layered_image",
"label": "$string:app_name"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "VsgHarmony"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
24 changes: 24 additions & 0 deletions examples/platform/vsgharmony/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# VSG Example for HarmonyOS

This example demonstrates how to create a window, load assets and render a scene within a XComponent application.

Note: this example focuses on VSG usage,not the best development practice for HarmonyOS NativeWindow

## Prerequisites

* DevEco Studio 6+
* Harmony SDK API Level 19
* CMake 3.5
* Device running HarmonyOS 6 or higher which supports Vulkan 1.0 (The DevEco's semulator does not support valkan)


## Building with Android Studio

1. Open DevEco Studio and select 'Open'
2. Select the vsgharmony folder
3. Open /src/main/cpp/CMakeLists.txt and update the section 'find vsg' to either:
* `set(CMAKE_PREFIX_PATH /path/to/VulkanSceneGraph vsg )`
4 Modify the line `set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)` in the file `ohos.toolchain.cmake` to prevent `find_package` from failing to find libraries outside the cross-compilation environment.

4. Build the application

57 changes: 57 additions & 0 deletions examples/platform/vsgharmony/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"app": {
"signingConfigs": [
{
"name": "default",
"type": "HarmonyOS",
"material": {
"certpath": "C:\\Users\\huang\\.ohos\\config\\default_VsgHarmony_Gj_LbL9cJ7EqTcCncNlPZOjKrVWG1MP7KjQ_Hw-o5vI=.cer",
"keyAlias": "debugKey",
"keyPassword": "0000001B9470B06A9DDC478428FA95362BF81DDAD5B880F9F1DB9510C2F4D63244AD79A16F871A48FC141A",
"profile": "C:\\Users\\huang\\.ohos\\config\\default_VsgHarmony_Gj_LbL9cJ7EqTcCncNlPZOjKrVWG1MP7KjQ_Hw-o5vI=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\huang\\.ohos\\config\\default_VsgHarmony_Gj_LbL9cJ7EqTcCncNlPZOjKrVWG1MP7KjQ_Hw-o5vI=.p12",
"storePassword": "0000001B58A94E1024D9D51B5B8EA8CC2F399599FCA4B6D887C6D92A65B8DF39F2749248AF80550F35700B"
}
}
],
"products": [
{
"name": "default",
"signingConfig": "default",
"targetSdkVersion": "6.0.0(20)",
"compatibleSdkVersion": "6.0.0(20)",
"runtimeOS": "HarmonyOS",
"buildOption": {
"nativeCompiler": "BiSheng",
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
32 changes: 32 additions & 0 deletions examples/platform/vsgharmony/code-linter.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"files": [
"**/*.ets"
],
"ignore": [
"**/src/ohosTest/**/*",
"**/src/test/**/*",
"**/src/mock/**/*",
"**/node_modules/**/*",
"**/oh_modules/**/*",
"**/build/**/*",
"**/.preview/**/*"
],
"ruleSet": [
"plugin:@performance/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@security/no-unsafe-aes": "error",
"@security/no-unsafe-hash": "error",
"@security/no-unsafe-mac": "warn",
"@security/no-unsafe-dh": "error",
"@security/no-unsafe-dsa": "error",
"@security/no-unsafe-ecdsa": "error",
"@security/no-unsafe-rsa-encrypt": "error",
"@security/no-unsafe-rsa-sign": "error",
"@security/no-unsafe-rsa-key": "error",
"@security/no-unsafe-dsa-key": "error",
"@security/no-unsafe-dh-key": "error",
"@security/no-unsafe-3des": "error"
}
}
6 changes: 6 additions & 0 deletions examples/platform/vsgharmony/entry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
47 changes: 47 additions & 0 deletions examples/platform/vsgharmony/entry/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"apiType": "stageMode",
"buildOption": {
"resOptions": {
"copyCodeResource": {
"enable": false
}
},
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": "",
"abiFilters": [
"arm64-v8a"
]
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
"nativeLib": {
"debugSymbol": {
"strip": true,
"exclude": []
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
6 changes: 6 additions & 0 deletions examples/platform/vsgharmony/entry/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { hapTasks } from '@ohos/hvigor-ohos-plugin';

export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
}
23 changes: 23 additions & 0 deletions examples/platform/vsgharmony/entry/obfuscation-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5

# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file

# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope

-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
19 changes: 19 additions & 0 deletions examples/platform/vsgharmony/entry/oh-package-lock.json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions examples/platform/vsgharmony/entry/oh-package.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"libentry.so": "file:./src/main/cpp/types/libentry"
}
}
22 changes: 22 additions & 0 deletions examples/platform/vsgharmony/entry/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(VsgHarmony)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
include(${PACKAGE_FIND_FILE})
endif()
#set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "D:/cmakelib_harmony/armv8a")
find_package(vsg REQUIRED NO_CMAKE_FIND_ROOT_PATH)

include_directories(${NATIVERENDER_ROOT_PATH}
${NATIVERENDER_ROOT_PATH}/include)

add_library(entry SHARED napi_init.cpp)
target_link_libraries(entry PUBLIC libace_napi.z.so
vsg::vsg
hilog_ndk.z #log
ace_ndk.z
native_window
)
Loading