添加C++ native工程代码

This commit is contained in:
2024-04-23 11:02:19 +08:00
parent c49f7d821f
commit 09b129fe5a
6 changed files with 114 additions and 0 deletions

29
cppLib/build.bat Normal file
View File

@@ -0,0 +1,29 @@
@echo off
chcp 65001 > nul
set native_path=D:\AppData\Huawei\Sdk\HarmonyOS-NEXT-DP2\base\native\
set toolchain=%native_path%build\cmake\ohos.toolchain.cmake
set cmake_root=%native_path%build-tools\cmake\
set cmake_path=%cmake_root%bin\cmake.exe
set ninja_path=%cmake_root%bin\ninja.exe
set make_path=C:\MinGW\msys\1.0\bin\make.exe
if exist build (
del /q /s build
) else (
mkdir build
)
if exist dist (
del /q /s dist
)
cd build
:: 使用 make 构建
:: %cmake_path% -G"Unix Makefiles" -DCMAKE_MAKE_PROGRAM="%make_path%" -DOHOS_STL=c++_static -DOHOS_ARCH=arm64-v8a -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=%toolchain% ..
:: %make_path%
:: 使用 ninja 构建
%cmake_path% -GNinja -DCMAKE_MAKE_PROGRAM="%ninja_path%" -DOHOS_STL=c++_static -DOHOS_ARCH=arm64-v8a -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=%toolchain% ..
%ninja_path%
cd ../