Files
cocos4/templates/cmake/openharmony.cmake
T
James Chen d2c3429f95 Refactor Openharmony platform code to support switching between napi (ark js runtime) and v8 (#16093)
* OH could use v8 now.

* napi addon works.

* Use Napi addon to refactor code.

* Fix compilation errors.

* tweak

* Refactor oh platform, remove some hacking for oh.

* Fix log in runScript.

* Fix the issues in napi mode.

* Revert.

* Remove an unused comment.

* Refactor log output in NapiHelper.cpp and OpenHarmonyPlatform.cpp

* Update oh template.

* Remove unused code.

* Remove unused debug log in jsb-gfx.js

* Update include

* Revert Screen::isDisplayStats.

* update OH template for v8 backend

* update

* Update CMakeLists.txt for OH

* Fix a compilation error in NapiHelper.cpp while switching to NAPI mode

* Keep the symbol of entry function.

* Add -Wl,--gc-sections and add -Wl,-s for release mode.

* Update external to 3.8.2-1

* Don't use `console.assert` directly.

* Remove oh specific methods ( getInnerWidth/Height, getWindowHandle ) in Device class.

---------

Co-authored-by: PP_Pro <chinese1236@qq.com>
2023-09-01 16:27:08 +08:00

25 lines
745 B
CMake

macro(cc_openharmony_before_target target_name)
list(APPEND CC_COMMON_SOURCES
${COCOS_X_PATH}/cocos/platform/openharmony/napi/NapiInit.cpp
)
set(CC_ALL_SOURCES ${CC_COMMON_SOURCES} ${CC_PROJ_SOURCES})
cc_common_before_target(${target_name})
endmacro()
macro(cc_openharmony_after_target target_name)
target_link_libraries(${target_name}
${ENGINE_NAME}
)
target_link_options(${target_name} PRIVATE -Wl,--gc-sections)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
target_link_options(${target_name} PRIVATE -Wl,-s)
endif()
target_include_directories(${target_name} PRIVATE
${CC_PROJECT_DIR}/../common/Classes
)
cc_common_after_target(${target_name})
endmacro()