scirpt: build script.

This commit is contained in:
2025-07-06 13:04:05 +08:00
parent a65764dd5b
commit 3323755800
10 changed files with 64 additions and 110 deletions

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ cmake-*
xpbuild
.xmake
compile_commands.json
build*

View File

@@ -2,7 +2,7 @@ add_rules("mode.debug", "mode.release")
target("SingleApplication")
add_rules("qt.static")
if has_config("single5") then
if has_config("qt5") then
add_defines("QT_DEFAULT_MAJOR_VERSION=5")
else
add_defines("QT_DEFAULT_MAJOR_VERSION=6")
@@ -24,8 +24,3 @@ target("SingleApplication")
add_frameworks("QtGui")
add_frameworks("QtWidgets")
add_frameworks("QtNetwork")
option("single5")
set_default(false)
set_showmenu(true)
set_description("SingleApplication Build with Qt5.")

View File

@@ -1,5 +1,4 @@
add_rules("mode.debug", "mode.release")
target("frelayGUI")
add_rules("qt.widgetapp")
add_defines("QAPPLICATION_CLASS=QApplication")
@@ -17,6 +16,9 @@ target("frelayGUI")
add_files("*.h")
add_files("../Res/frelay.qrc")
add_files("../Res/ico.rc")
if is_plat("windows") then
add_ldflags("-subsystem:windows")
end
add_frameworks("QtCore")
add_frameworks("QtGui")
add_frameworks("QtNetwork")
@@ -25,4 +27,8 @@ target("frelayGUI")
add_deps("Util")
add_deps("ClientCore")
add_deps("SingleApplication")
if is_plat("mingw") then
add_ldflags("-mwindows")
else
add_deps("crashelper")
end

View File

@@ -3,15 +3,17 @@ current_user=$(whoami)
qt_path="/home/${current_user}/Qt5.14.2/5.14.2/gcc_64"
if [ -d "$qt_path" ]; then
echo "Found Qt directory: $qt_path"
cmake -B../build -S../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$qt_path" -DQT_DEFAULT_MAJOR_VERSION=5 -DCOMPILE_GUI=ON
cmake --build ../build --config Release
cd ..
xmake f -a x64 -m release --qt="$qt_path" --gui=y --qt5=y -o build-linux -v
xmake
if [ $? -eq 0 ]; then
echo "cmake command executed successfully"
echo "xmake command executed successfully"
else
echo "cmake command failed"
echo "xmake command failed"
exit 1
fi
else

13
Script/qt6build.bat Normal file
View File

@@ -0,0 +1,13 @@
@echo off
cd ..
xmake f -p windows -a x64 -m release --qt=C:\Qt\6.8.3 --gui=y -o build-qt6 -v
xmake -r
set outDir=%~dp0..\build-qt6\windows\x64\release\
if %errorlevel% equ 0 (
del /q "%outDir%\*.lib" 2>nul
for /f "delims=" %%f in ('dir /b /a-d "%outDir%\*Test*" 2^>nul') do (
del /q "%outDir%\%%f"
)
C:\Qt\6.8.3\bin\windeployqt.exe %outDir%frelayGUI.exe
)
pause

View File

@@ -1,2 +1,11 @@
cmake -B../build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/data/data/com.termux/files/usr/lib -S../
cmake --build ../build --config Release
#!/bin/bash
cd ..
xmake f -a x64 -m release --qt="/data/data/com.termux/files/usr/lib" --qt5=y -o build-linux -v
xmake
if [ $? -eq 0 ]; then
echo "xmake command executed successfully"
else
echo "xmake command failed"
exit 1
fi

View File

@@ -1,58 +0,0 @@
!define APP_NAME "frelay"
!define APP_VERSION "0.2.0.0"
!define COMPANY_NAME "Taynpg"
!define INSTALL_DIR "$PROFILE\frelay"
!define SOURCE_DIR "..\xpbuild\bin\Release"
Name "${APP_NAME}"
OutFile "${APP_NAME}Setup_${APP_VERSION}.exe"
InstallDir "${INSTALL_DIR}"
InstallDirRegKey HKCU "Software\${COMPANY_NAME}\${APP_NAME}" "InstallDir"
RequestExecutionLevel user
!include "MUI2.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Section "Main Program" SecMain
SetOutPath "$INSTDIR"
File /r "${SOURCE_DIR}\*.*"
CreateShortCut "$DESKTOP\${APP_NAME} Console.lnk" "$INSTDIR\frelayConsole.exe"
CreateShortCut "$DESKTOP\${APP_NAME} GUI.lnk" "$INSTDIR\frelayGUI.exe"
CreateShortCut "$DESKTOP\${APP_NAME} Server.lnk" "$INSTDIR\frelayServer.exe"
WriteRegStr HKCU "Software\${COMPANY_NAME}\${APP_NAME}" "InstallDir" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "DisplayName" "${APP_NAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "Publisher" "${COMPANY_NAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "DisplayVersion" "${APP_VERSION}"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
Delete "$DESKTOP\${APP_NAME} Console.lnk"
Delete "$DESKTOP\${APP_NAME} GUI.lnk"
Delete "$DESKTOP\${APP_NAME} Server.lnk"
RMDir /r "$INSTDIR"
DeleteRegKey HKCU "Software\${COMPANY_NAME}\${APP_NAME}"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
SectionEnd
VIProductVersion "${APP_VERSION}.0"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "FileDescription" "${APP_NAME} Installer"
VIAddVersionKey "FileVersion" "${APP_VERSION}"
VIAddVersionKey "CompanyName" "${COMPANY_NAME}"
VIAddVersionKey "LegalCopyright" "? ${COMPANY_NAME}"

View File

@@ -1,37 +1,17 @@
@echo on
set QT_563_ROOT=C:\Qt\Qt5.6.3
set QT_DIRS="%QT_563_ROOT%\5.6.3\mingw49_32"
set QT_GCC_ROOT="%QT_563_ROOT%\Tools\mingw49_32\bin"
set QT_DIR=C:\Qt\Qt5.7.1\5.7\mingw53_32
set COMPILE_DIR=C:\Qt\Qt5.7.1\Tools\mingw530_32
set MINGWDLL1="%QT_563_ROOT%\Tools\mingw492_32\bin\libgcc_s_dw2-1.dll"
set MINGWDLL2="%QT_563_ROOT%\Tools\mingw492_32\bin\libstdc++-6.dll"
set MINGWDLL3="%QT_563_ROOT%\Tools\mingw492_32\bin\libwinpthread-1.dll"
set QTDLL1="%QT_563_ROOT%\5.6.3\mingw49_32\bin\Qt5Core.dll"
set QTDLL2="%QT_563_ROOT%\5.6.3\mingw49_32\bin\Qt5Gui.dll"
set QTDLL3="%QT_563_ROOT%\5.6.3\mingw49_32\bin\Qt5Widgets.dll"
set QTDLL4="%QT_563_ROOT%\5.6.3\mingw49_32\bin\Qt5Network.dll"
set QTDLL5="%QT_563_ROOT%\5.6.3\mingw49_32\plugins\platforms\qwindows.dll"
set PAHT=%PATH%;%QT_GCC_ROOT%;
cmake -B"%~dp0..\xpbuild" -S"%~dp0.." -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%QT_DIRS% -DQT_DEFAULT_MAJOR_VERSION=5 -DXP_PLATFORM_SUPPORT=ON -DCOMPILE_GUI=ON
cmake --build "%~dp0..\xpbuild" --config Release
set PATH=%PATH%;%COMPILE_DIR\bin%
xmake f -p mingw --sdk=C:\Qt\Qt5.7.1\Tools\mingw530_32 -a i386 -m release --qt=%QT_DIR% --gui=y --qt5=y --xp=y -o build-xp -v
xmake
set outDir=%~dp0..\build-xp\mingw\i386\release\
if %errorlevel% equ 0 (
if not exist "%~dp0..\xpbuild\bin\Release\platforms" (
mkdir "%~dp0..\xpbuild\bin\Release\platforms"
del /q "%outDir%\*.a" 2>nul
for /f "delims=" %%f in ('dir /b /a-d "%outDir%\*Test*" 2^>nul') do (
del /q "%outDir%\%%f"
)
xcopy /Y %MINGWDLL1% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %MINGWDLL2% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %MINGWDLL3% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %QTDLL1% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %QTDLL2% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %QTDLL3% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %QTDLL4% "%~dp0..\xpbuild\bin\Release"
xcopy /Y %QTDLL5% "%~dp0..\xpbuild\bin\Release\platforms"
del /f /q "%~dp0..\xpbuild\bin\Release\frelayBaseTest.exe"
del /f /q "%~dp0..\xpbuild\bin\Release\frelayTest.exe"
%QT_DIR%\bin\windeployqt.exe %outDir%frelayGUI.exe
)
pause

View File

@@ -4,7 +4,7 @@
#include "Server.h"
#ifndef COMPILER_USE_MINGW
#ifndef NO_CRASHELPER
#include <crashelper.h>
#endif
@@ -17,7 +17,7 @@ int main(int argc, char* argv[])
port = atoi(argv[1]);
}
#ifndef COMPILER_USE_MINGW
#ifndef NO_CRASHELPER
auto configDir = Util::GetCurConfigPath("frelay");
#ifdef _WIN32
backward::SetDumpFileSavePath(configDir + "/dumpfile");

View File

@@ -20,6 +20,7 @@ add_defines("FMT_HEADER_ONLY")
add_includedirs("3rd")
if has_config("gui") then
add_includedirs("Gui/Control")
includes("Gui", "3rd/SingleApplication-3.5.2")
end
@@ -41,3 +42,8 @@ option("gui")
set_default(false)
set_showmenu(true)
set_description("Enable GUI support")
option("qt5")
set_default(false)
set_showmenu(true)
set_description("Use Qt5 instead of Qt6.")