Skip to content

Commit

Permalink
Add a simple OpenGL demo for the HarmonyOS platform. (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
domchen authored Jul 3, 2024
1 parent be43219 commit 9a1325a
Show file tree
Hide file tree
Showing 43 changed files with 1,320 additions and 0 deletions.
12 changes: 12 additions & 0 deletions harmonyos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
10 changes: 10 additions & 0 deletions harmonyos/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "org.tgfx.hello2d",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
8 changes: 8 additions & 0 deletions harmonyos/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": "Hello2D"
}
]
}
3 changes: 3 additions & 0 deletions harmonyos/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.
49 changes: 49 additions & 0 deletions harmonyos/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"app": {
"signingConfigs": [
{
"name": "default",
"type": "HarmonyOS",
"material": {
"certpath": "/Users/dom/.ohos/config/default_harmonyos_yQ8nAit9-rVCEops_bcdyLiKQ2mIT0leIE0pNeGMKks=.cer",
"storePassword": "0000001A7A4E3A895C11695E6B1DF6D4C0F5930B437380B3D79D2A5149BDCBC8303D29983241522D5423",
"keyAlias": "debugKey",
"keyPassword": "0000001A4AB6C3172F717A47A1145D26792A5C6CC28A550F0A4CF34173B56ADA0A7A9EB436170EEE6F52",
"profile": "/Users/dom/.ohos/config/default_harmonyos_yQ8nAit9-rVCEops_bcdyLiKQ2mIT0leIE0pNeGMKks=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/dom/.ohos/config/default_harmonyos_yQ8nAit9-rVCEops_bcdyLiKQ2mIT0leIE0pNeGMKks=.p12"
}
}
],
"products": [
{
"name": "default",
"signingConfig": "default",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "hello2d",
"srcPath": "./hello2d",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
6 changes: 6 additions & 0 deletions harmonyos/hello2d/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
39 changes: 39 additions & 0 deletions harmonyos/hello2d/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"apiType": "stageMode",
"buildOption": {
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": "",
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
"nativeLib": {
"debugSymbol": {
"strip": true,
"exclude": []
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
6 changes: 6 additions & 0 deletions harmonyos/hello2d/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. */
}
18 changes: 18 additions & 0 deletions harmonyos/hello2d/obfuscation-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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
18 changes: 18 additions & 0 deletions harmonyos/hello2d/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 harmonyos/hello2d/oh-package.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "hello2d",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"libhello2d.so": "file:./src/main/cpp/types/libhello2d"
}
}
19 changes: 19 additions & 0 deletions harmonyos/hello2d/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(harmonyos)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
include(${PACKAGE_FIND_FILE})
endif()

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

find_library(EGL-lib EGL)
find_library(GLES-lib GLESv3)
find_library(libace-lib ace_ndk.z)
find_library(hilog-lib hilog_ndk.z)
add_library(hello2d SHARED napi_init.cpp egl_core.cpp)
target_link_libraries(hello2d PUBLIC ${EGL-lib} ${GLES-lib} ${libace-lib} ${hilog-lib} libace_napi.z.so)
Loading

0 comments on commit 9a1325a

Please sign in to comment.