From 6a3d4d4b99d0b7437d72ed77dd432cccbfdefe64 Mon Sep 17 00:00:00 2001 From: asc Date: Mon, 27 Feb 2023 20:26:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=86windows=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE=E7=BC=96=E8=AF=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8C=96=E6=9E=84=E5=BB=BAbat?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- windows.bat | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 windows.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index fd11dd5..be8b0a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.20) project(Notepad-- VERSION 1.22.0) diff --git a/windows.bat b/windows.bat new file mode 100644 index 0000000..4ae3d0b --- /dev/null +++ b/windows.bat @@ -0,0 +1,73 @@ +@echo off + +set build_dir=build +set source_dir=. +set generator=-G Ninja +set build_type_debug=Debug +set build_type_release=Relase +set build_type=%build_type_debug% +set universal=ON +set qt=ON +set qt5=ON +set qt6=OFF + + + +echo finding vcvars64.bat... +set vcvars= +for %%i in (C: D: E: F: G: H:) do ( + if exist %%i ( + pushd %%i\ + for /r %%j in (*vcvars64.bat) do ( + set vcvars=%%j + popd + goto :find_vcvars + ) + popd + ) +) + +:find_vcvars +if not "%vcvars%"=="" ( + call "%vcvars%" + echo config MSVC environment... +)else ( + echo error: could not find vcvars64.bat MSVC ENV config file. + goto :out +) + +echo finding qt msvc path... +set qt_msvc= +for %%i in (D: D: E: F: G: H:) do ( + if exist %%i ( + pushd %%i\ + for /d /r %%j in (*msvc20*) do ( + echo %%j + if exist %%j\bin ( + if exist %%j\bin\windeployqt.exe ( + if exist %%j\bin\Qt5Core.dll ( + set qt_msvc=%%j + popd + goto :find_qt_msvc + ) + ) + ) + ) + popd + ) +) + +:find_qt_msvc +if not "%qt_msvc%"=="" ( + echo config qt msvc path... +) else ( + echo error: could not find qt msvc path. + goto :out +) + +cmake -B%build_dir% CMAKE_BUILD_TYPE=%build_type% %generator% -DUSE_WINDOWS_UNIVERSAL=%universal% -DWINDOWS_DEPLOY_QT=%qt% -DWINDOWS_DEPLOY_QT5=%qt5% -DWINDOWS_DEPLOY_QT6=%qt6% -DCMAKE_PREFIX_PATH=%qt_msvc% %source_dir% +cmake --build %build_dir% -- +xcopy %build_dir%\windows-deployqt\Notepad--.app\bin\ %build_dir%\bin\ /e + +:out +pause \ No newline at end of file