Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update configure.bat #408

Merged
merged 10 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ jobs:
- uses: actions/checkout@main
- name: Homebrew
run: |
which pkg-config || brew install pkg-config
brew install qt6 jq
brew link qt
- name: configure
run: ./configure --prefix=/usr/local
- name: build
Expand All @@ -164,8 +164,8 @@ jobs:
- uses: actions/checkout@main
- name: Homebrew
run: |
brew install qt6 pkg-config jq mongo-c-driver gflags glog lz4
brew link qt
which pkg-config || brew install pkg-config
brew install qt6 jq mongo-c-driver gflags glog lz4
- name: configure
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
- name: build
Expand Down Expand Up @@ -205,6 +205,7 @@ jobs:
choco install visualstudio2022community -y
choco install visualstudio2022-workload-nativedesktop -y
choco install sqlite -y
choco install cmake -y
- name: Build for debug mode
shell: cmd
run: |
Expand Down Expand Up @@ -236,9 +237,8 @@ jobs:
nmake
nmake install
- name: Test release
shell: cmd
working-directory: tools\test\releasetest
run: |
cd tools\test\releasetest
.\releasetest.bat

build-windows-qt67-msvc2019:
Expand All @@ -256,6 +256,7 @@ jobs:
choco install visualstudio2019community -y
choco install visualstudio2019-workload-nativedesktop -y
choco install sqlite -y
choco install cmake -y
- name: Build for debug mode
shell: cmd
run: |
Expand Down Expand Up @@ -287,9 +288,8 @@ jobs:
nmake
nmake install
- name: Test release
shell: cmd
working-directory: tools\test\releasetest
run: |
cd tools\test\releasetest
.\releasetest.bat

build-windows-qt65-msvc2019:
Expand All @@ -307,6 +307,7 @@ jobs:
choco install visualstudio2019community -y
choco install visualstudio2019-workload-nativedesktop -y
choco install sqlite -y
choco install cmake -y
- name: Build for debug mode
shell: cmd
run: |
Expand Down Expand Up @@ -338,7 +339,6 @@ jobs:
nmake
nmake install
- name: Test release
shell: cmd
working-directory: tools\test\releasetest
run: |
cd tools\test\releasetest
.\releasetest.bat
24 changes: 13 additions & 11 deletions configure.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo OFF
@echo off
@setlocal

set VERSION=2.10.0
Expand Down Expand Up @@ -58,9 +58,9 @@ if "%DEBUG%" == "yes" (
::
:: Generates tfenv.bat
::
for %%I in (nmake.exe) do if exist %%~$path:I set MAKE=%%~$path:I
for %%I in (nmake.exe) do if exist %%~$path:I set NMAKE=%%~$path:I
if "%MAKE%" == "" (
for %%I in (jom.exe) do if exist %%~$path:I set MAKE=%%~$path:I
for %%I in (jom.exe) do if exist %%~$path:I set NMAKE=%%~$path:I
)
for %%I in (qmake.exe) do if exist %%~$path:I set QMAKE=%%~$path:I
for %%I in (cmake.exe) do if exist %%~$path:I set CMAKE=%%~$path:I
Expand All @@ -81,7 +81,7 @@ if "%CMAKE%" == "" (
)
cmake --version

if "%MAKE%" == "" (
if "%NMAKE%" == "" (
echo Make not found
pause
exit
Expand All @@ -100,14 +100,17 @@ if /i "%Platform%" == "x64" (
:: Visual Studio 2017
set VCVARSOPT=amd64
set CMAKEOPT=-A x64 -T v141
set MSVSVER=2017
) else if "%VisualStudioVersion%" == "16.0" (
:: Visual Studio 2019
set VCVARSOPT=amd64
set CMAKEOPT=-A x64 -T v142
set MSVSVER=2019
) else (
:: Visual Studio 2022
set VCVARSOPT=amd64
set CMAKEOPT=-A x64
set MSVSVER=2022
)
) else (
set VCVARSOPT=x86
Expand All @@ -130,7 +133,7 @@ echo set TreeFrog_DIR=%TFDIR%>> %TFENV%
echo set QMAKESPEC=%QMAKESPEC%>> %TFENV%
echo set QTENV="%QTENV%">> %TFENV%
echo set VCVARSBAT="">> %TFENV%
echo set VSVER=2022 2019 2017>> %TFENV%
echo set VSVER=%MSVSVER%>> %TFENV%
echo set VSWHERE="%%ProgramFiles(x86)%%\Microsoft Visual Studio\Installer\vswhere.exe">> %TFENV%
echo;>> %TFENV%
echo if exist %%QTENV%% call %%QTENV%%>> %TFENV%
Expand All @@ -157,7 +160,6 @@ echo set VSWHERE=>> %TFENV%
echo set PATH=%%TFDIR^%%\bin;%%PATH%%>> %TFENV%
echo echo Setup a TreeFrog/Qt environment.>> %TFENV%
echo echo -- TFDIR set to %%TFDIR%%>> %TFENV%
echo cd /D %%HOMEDRIVE%%%%HOMEPATH%%>> %TFENV%

set TFDIR=%TFDIR:\=/%
del /f /q .qmake.stash src\.qmake.stash tools\.qmake.stash >nul 2>&1
Expand Down Expand Up @@ -236,17 +238,17 @@ if ERRORLEVEL 1 (

:: Builds TreeFrog
cd %BASEDIR%src
if exist Makefile ( "%MAKE%" -k distclean >nul 2>&1 )
if exist Makefile ( nmake distclean >nul 2>&1 )
qmake %OPT% target.path='%TFDIR%/bin' header.path='%TFDIR%/include' %USE_GUI%

cd %BASEDIR%tools
if exist Makefile ( "%MAKE%" -k distclean >nul 2>&1 )
if exist Makefile ( nmake distclean >nul 2>&1 )
qmake -recursive %OPT% target.path='%TFDIR%/bin' header.path='%TFDIR%/include' datadir='%TFDIR%'
"%MAKE%" qmake
nmake qmake

echo;
echo First, run "%MAKE% install" in src directory.
echo Next, run "%MAKE% install" in tools directory.
echo First, run "nmake install" in src directory.
echo Next, run "nmake install" in tools directory.

:exit
exit /b
117 changes: 55 additions & 62 deletions tools/test/releasetest/releasetest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ if not "%TFENV%" == "" (
call "..\..\..\tfenv.bat"
)

for %%I in (nmake.exe) do if exist %%~$path:I set MAKE=%%~$path:I
if "%MAKE%" == "" (
for %%I in (jom.exe) do if exist %%~$path:I set MAKE=%%~$path:I
if not "%MAKE%" == "" (
set MAKE=jom
for %%I in (nmake.exe) do if exist %%~$path:I set NMAKE=%%~$path:I
if "%NMAKE%" == "" (
for %%I in (jom.exe) do if exist %%~$path:I set NMAKE=%%~$path:I
if not "%NMAKE%" == "" (
set NMAKE=jom
)
) else (
set MAKE=nmake VERBOSE=1
set NMAKE=nmake VERBOSE=1
)
for %%I in (qmake.exe) do if exist %%~$path:I set QMAKE=%%~$path:I
for %%I in (cmake.exe) do if exist %%~$path:I set CMAKE=%%~$path:I
for %%I in (sqlite3.exe) do if exist %%~$path:I set SQLITE=%%~$path:I
if "%SQLITE%" == "" for %%I in (sqlite3-bin.exe) do if exist %%~$path:I set SQLITE=%%~$path:I

if "%MAKE%" == "" (
if "%NMAKE%" == "" (
echo;
echo nmake.exe not found.
call :CleanUp
Expand Down Expand Up @@ -59,7 +59,7 @@ if /i "%Platform%" == "x64" (
)

cd /D %BASEDIR%
rd /Q /S %APPNAME%
rd /Q /S %APPNAME% >nul 2>nul
tspawn new %APPNAME%
if "%SQLITE%" == "" (
echo;
Expand All @@ -73,40 +73,29 @@ cd %APPDIR%
echo n | tspawn s blog
tspawn w foo

:: Set ExecutionPolicy
@REM for %%I in (tadpoled.exe) do if exist %%~$path:I set TADPOLED=%%~$path:I
@REM for %%I in (tadpole.exe) do if exist %%~$path:I set TADPOLE=%%~$path:I
powershell -Command "Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser -Force"
@REM powershell -command "New-NetFirewallRule -DisplayName MyAppAccess1 -Direction Inbound -Action Allow -Profile Public,Private -Program '%TADPOLED%' -Protocol TCP -LocalPort %PORT% -RemoteAddress 127.0.0.1" >nul 2>&1
@REM powershell -command "New-NetFirewallRule -DisplayName MyAppAccess2 -Direction Inbound -Action Allow -Profile Public,Private -Program '%TADPOLE%' -Protocol TCP -LocalPort %PORT% -RemoteAddress 127.0.0.1" >nul 2>&1

:: Test in debug mode
if not "%CMAKE%" == "" (
call :CMakeBuild Debug
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrogd.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
)
call :CMakeBuild Debug
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrogd.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%

call :QMakeBuild debug
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrogd.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
%MAKE% distclean >nul 2>nul
nmake distclean >nul 2>nul

:: Test in release mode
if not "%CMAKE%" == "" (
call :CMakeBuild Release
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrog.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
)
call :CMakeBuild Release
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrog.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%

call :QMakeBuild release
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
call :CheckWebApp treefrog.exe
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
%MAKE% distclean >nul 2>nul
nmake distclean >nul 2>nul

echo;
echo Test OK
Expand Down Expand Up @@ -145,8 +134,8 @@ exit /B 0
:QMakeBuild
cd /D %APPDIR%
del /Q /F lib\*.*
qmake -r CONFIG+=%1
%MAKE%
"%QMAKE%" -r CONFIG+=%1
%NMAKE%
if ERRORLEVEL 1 (
echo;
echo Build Error!
Expand All @@ -167,49 +156,53 @@ if "%TREEFROG%" == "" (
exit /B 1
)

"%1" -v
"%1" -l
"%1" --show-routes
echo "%TREEFROG%" -v
"%TREEFROG%" -v 2>&1
echo "%TREEFROG%" -l
"%TREEFROG%" -l 2>&1
echo "%TREEFROG%" --show-routes
"%TREEFROG%" --show-routes 2>&1
if ERRORLEVEL 1 (
echo App Error!
exit /B 1
)
echo;

"%1" --settings
echo "%TREEFROG%" --settings
"%TREEFROG%" --settings 2>&1
if ERRORLEVEL 1 (
echo App Error!
type log\treefrog.log
exit /B 1
)
echo;

@REM echo Starting webapp..
@REM set RES=1
@REM "%1" -e dev -d -p %PORT% %APPDIR%
@REM if ERRORLEVEL 1 (
@REM echo App Start Error!
@REM exit /B 1
@REM )

@REM timeout 1 /nobreak >nul
@REM set URL=http://localhost:%PORT%/blog
@REM set CMD=curl -s "%URL%" -w "%%{http_code}" -o nul
@REM set RESCODE=0
@REM for /f "usebackq delims=" %%a in (`%CMD%`) do set RESCODE=%%a
@REM "%1" -k stop %APPDIR%
@REM if ERRORLEVEL 1 (
@REM "%1" -k abort %APPDIR%
@REM )
@REM timeout 1 /nobreak >nul
@REM if not "%RESCODE%"=="200" (
@REM echo HTTP request failed
@REM echo;
@REM echo App Test Error!
@REM call :CleanUp
@REM exit /B 1
@REM )
@REM echo HTTP request success "%URL%"
echo Starting webapp..
set RES=1
"%1" -e dev -d -p %PORT% %APPDIR%
if ERRORLEVEL 1 (
echo App Start Error!
exit /B 1
)

timeout 1 /nobreak >nul
set URL=http://localhost:%PORT%/blog
set CMD=curl -s "%URL%" -w "%%{http_code}" -o nul
set RESCODE=0
for /f "usebackq delims=" %%a in (`%CMD%`) do set RESCODE=%%a
"%1" -k stop %APPDIR%
if ERRORLEVEL 1 (
"%1" -k abort %APPDIR%
)
timeout 1 /nobreak >nul
if not "%RESCODE%"=="200" (
echo HTTP request failed
echo;
echo App Test Error!
call :CleanUp
exit /B 1
)
echo HTTP request success "%URL%"

exit /B 0

Expand All @@ -218,7 +211,7 @@ exit /B 0
::
:CleanUp
cd /D %BASEDIR%
rd /Q /S %APPNAME%
rd /Q /S %APPNAME% >nul 2>nul
exit /B 0

:: which cmd
Expand Down
Loading