From b58e7260046f062b991de2681ff03ebee0cb47dc Mon Sep 17 00:00:00 2001 From: DevWiki Date: Tue, 28 May 2024 20:19:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0x86=5F64=20=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cppLib/build_all.bat | 7 +++++++ hmcalculate/build-profile.json5 | 3 ++- hmcalculate/src/main/cpp/CMakeLists.txt | 11 ++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 cppLib/build_all.bat diff --git a/cppLib/build_all.bat b/cppLib/build_all.bat new file mode 100644 index 0000000..39ebe7a --- /dev/null +++ b/cppLib/build_all.bat @@ -0,0 +1,7 @@ +@echo off +chcp 65001 > nul +build.bat + +build.bat x86_64 + +build.bat \ No newline at end of file diff --git a/hmcalculate/build-profile.json5 b/hmcalculate/build-profile.json5 index 57f6d3e..0b5f0f8 100644 --- a/hmcalculate/build-profile.json5 +++ b/hmcalculate/build-profile.json5 @@ -6,7 +6,8 @@ "arguments": "", "cppFlags": "", "abiFilters": [ - "arm64-v8a" + "arm64-v8a", + "x86_64" ] } }, diff --git a/hmcalculate/src/main/cpp/CMakeLists.txt b/hmcalculate/src/main/cpp/CMakeLists.txt index 87adeaf..08c5635 100644 --- a/hmcalculate/src/main/cpp/CMakeLists.txt +++ b/hmcalculate/src/main/cpp/CMakeLists.txt @@ -16,4 +16,13 @@ add_library(hmcalculate SHARED CalculateInfo.h CalculateAdaptor.cpp) -target_link_libraries(hmcalculate PUBLIC ${NATIVERENDER_ROOT_PATH}/../../../../cppLib/dist/lib/arm64-v8a/libcalculate.so) \ No newline at end of file +# 根据不同的架构选择不同的库文件路径 +IF(OHOS_ARCH STREQUAL "arm64-v8a") + set(LIB_DIR ${NATIVERENDER_ROOT_PATH}/../../../../cppLib/dist/lib/arm64-v8a) +ELSEIF(OHOS_ARCH STREQUAL "x86_64") + set(LIB_DIR ${NATIVERENDER_ROOT_PATH}/../../../../cppLib/dist/lib/x86_64) +ELSE() + MESSAGE(FATAL_ERROR "Unsupported architecture: ${OHOS_ARCH}") +ENDIF() + +target_link_libraries(hmcalculate PUBLIC ${LIB_DIR}/libcalculate.so) \ No newline at end of file