优化构建脚本

This commit is contained in:
DevWiki 2024-06-25 15:00:04 +08:00
parent b3eb012942
commit d303942188
3 changed files with 25 additions and 13 deletions

View File

@ -9,7 +9,7 @@
"@devwiki/common_ui": "file:../common_ui", "@devwiki/common_ui": "file:../common_ui",
"@devwiki/base": "file:../base", "@devwiki/base": "file:../base",
"@ohos/axios": "^2.2.0", "@ohos/axios": "^2.2.0",
// "@devwiki/hmcalculate": "file:../hmcalculate" "@devwiki/hmcalculate": "file:../hmcalculate"
}, },
"devDependencies": {}, "devDependencies": {},
"dynamicDependencies": {} "dynamicDependencies": {}

View File

@ -1,16 +1,28 @@
@echo off @echo off
chcp 65001 > nul 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
set arch=arm64-v8a
IF NOT "%~1"=="" ( set "native_path=C:\Program Files\Huawei\DevEco Studio5\sdk\HarmonyOS-NEXT-DB1\openharmony\native\"
set arch=%1 IF NOT "%~1" == "" (
set "native_path=%~1"
) )
echo %native_path%
IF NOT "%~2" == "" (
set "arch=%~2"
)
set "toolchain=%native_path%build\cmake\ohos.toolchain.cmake"
echo %toolchain%
set "cmake_root=%native_path%build-tools\cmake\"
echo %cmake_root%
set "cmake_path=%cmake_root%bin\cmake.exe"
echo %cmake_path%
set "ninja_path=%cmake_root%bin\ninja.exe"
echo %ninja_path%
set "make_path=C:\MinGW\msys\1.0\bin\make.exe"
echo %make_path%
set "arch=arm64-v8a"
echo %arch%
if exist build ( if exist build (
del /q /s build del /q /s build
@ -28,11 +40,11 @@ if exist dist (
cd build cd build
:: 使用 make 构建 :: 使用 make 构建
:: %cmake_path% -G"Unix Makefiles" -DCMAKE_MAKE_PROGRAM="%make_path%" -DOHOS_STL=c++_static -DOHOS_ARCH="%arch%" -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=%toolchain% .. :: "%cmake_path%" -G"Unix Makefiles" -DCMAKE_MAKE_PROGRAM="%make_path%" -DOHOS_STL=c++_static -DOHOS_ARCH="%arch%" -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE="%toolchain%" ..
:: %make_path% :: %make_path%
:: 使用 ninja 构建 :: 使用 ninja 构建
%cmake_path% -GNinja -DCMAKE_MAKE_PROGRAM="%ninja_path%" -DOHOS_STL=c++_static -DOHOS_ARCH="%arch%" -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE=%toolchain% .. "%cmake_path%" -GNinja -DCMAKE_MAKE_PROGRAM="%ninja_path%" -DOHOS_STL=c++_static -DOHOS_ARCH="%arch%" -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE="%toolchain%" ..
%ninja_path% "%ninja_path%"
cd ../ cd ../

Binary file not shown.