From d2f64be5507c4d720aab8fa799da3d2cfd9fc1b1 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Tue, 16 Aug 2022 07:24:59 -0300 Subject: [PATCH] Make Windows build scripts reuse previous configuration. --- .../win32/BuildExecutableInstall.bat | 9 +++++++-- builds/win32/make_boot.bat | 14 +++++++------- builds/win32/run_all.bat | 18 ++---------------- builds/win32/setenvvar.bat | 15 +++++++++------ examples/build_win32/make_all.bat | 1 + 5 files changed, 26 insertions(+), 31 deletions(-) diff --git a/builds/install/arch-specific/win32/BuildExecutableInstall.bat b/builds/install/arch-specific/win32/BuildExecutableInstall.bat index 672889a591..bdfb121106 100644 --- a/builds/install/arch-specific/win32/BuildExecutableInstall.bat +++ b/builds/install/arch-specific/win32/BuildExecutableInstall.bat @@ -27,8 +27,13 @@ @echo off :: reset ERRLEV to clear error from last run in same cmd shell set ERRLEV=0 -:: Assume we are preparing a production build -set FBBUILD_BUILDTYPE=release + +:: Assume we are preparing a production build if FBBUILD_BUILDTYPE is not defined +if not defined FBBUILD_BUILDTYPE ( + set FB_DBG= + set FBBUILD_BUILDTYPE=release +) + :: Don't ship pdb files by default set FBBUILD_SHIP_PDB=no_pdb :: Reset "make" vars to zero diff --git a/builds/win32/make_boot.bat b/builds/win32/make_boot.bat index 6542a618ed..bf9f786930 100644 --- a/builds/win32/make_boot.bat +++ b/builds/win32/make_boot.bat @@ -119,10 +119,10 @@ goto :EOF :LibTom @echo. @echo Building LibTomMath (%FB_OBJ_DIR%)... -@call compile.bat extern\libtommath\libtommath_MSVC%MSVC_VERSION% libtommath_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtommath +@call compile.bat extern\libtommath\libtommath_MSVC%MSVC_VERSION% libtommath_%FBBUILD_BUILDTYPE%_%FB_TARGET_PLATFORM%.log libtommath if errorlevel 1 call :boot2 libtommath_%FB_OBJ_DIR% @echo Building LibTomCrypt (%FB_OBJ_DIR%)... -@call compile.bat extern\libtomcrypt\libtomcrypt_MSVC%MSVC_VERSION% libtomcrypt_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtomcrypt +@call compile.bat extern\libtomcrypt\libtomcrypt_MSVC%MSVC_VERSION% libtomcrypt_%FBBUILD_BUILDTYPE%_%FB_TARGET_PLATFORM%.log libtomcrypt if errorlevel 1 call :boot2 libtomcrypt_%FB_OBJ_DIR% goto :EOF @@ -131,7 +131,7 @@ goto :EOF :decNumber @echo. @echo Building decNumber (%FB_OBJ_DIR%)... -@call compile.bat extern\decNumber\msvc\decNumber_MSVC%MSVC_VERSION% decNumber_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log decNumber +@call compile.bat extern\decNumber\msvc\decNumber_MSVC%MSVC_VERSION% decNumber_%FBBUILD_BUILDTYPE%_%FB_TARGET_PLATFORM%.log decNumber if errorlevel 1 call :boot2 decNumber_%FB_OBJ_DIR% goto :EOF @@ -140,11 +140,11 @@ goto :EOF :ttmath @echo. @echo Building ttmath (%FB_OBJ_DIR%)... -@mkdir %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG% 2>nul -if /I "%FB_CONFIG%"=="debug" ( - @ml64.exe /c /Zi /Fo %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm +@mkdir %FB_ROOT_PATH%\extern\ttmath\%FBBUILD_BUILDTYPE% 2>nul +if /I "%FBBUILD_BUILDTYPE%"=="debug" ( + @ml64.exe /c /Zi /Fo %FB_ROOT_PATH%\extern\ttmath\%FBBUILD_BUILDTYPE%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm ) else ( - @ml64.exe /c /Fo %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm + @ml64.exe /c /Fo %FB_ROOT_PATH%\extern\ttmath\%FBBUILD_BUILDTYPE%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm ) if errorlevel 1 call :boot2 ttmath_%FB_OBJ_DIR% goto :EOF diff --git a/builds/win32/run_all.bat b/builds/win32/run_all.bat index b485ab63c0..5efa3da53d 100644 --- a/builds/win32/run_all.bat +++ b/builds/win32/run_all.bat @@ -5,7 +5,6 @@ set ERRLEV=0 set FBBUILD_NOCLEAN= set FBBUILD_REAL_CLEAN= -set FBBUILD_BUILDTYPE=release set FBBUILD_INCLUDE_PDB= set FBBUILD_MAKE_KITS_ONLY= set FBBUILD_BUILD_ONLY=0 @@ -24,7 +23,6 @@ for %%v in ( %1 %2 %3 %4 %5 %6 %7 %8 %9 ) do ( for %%v in ( %* ) do ( ( if /I "%%v"=="NOCLEAN" (set FBBUILD_NOCLEAN=1) ) ( if /I "%%v"=="REALCLEAN" (set FBBUILD_REAL_CLEAN=REALCLEAN) ) -( if /I "%%v"=="DEBUG" (set FBBUILD_BUILDTYPE=debug) ) ( if /I "%%v"=="PDB" (set FBBUILD_INCLUDE_PDB=1) ) ( if /I "%%v"=="REPACK" (set FBBUILD_MAKE_KITS_ONLY=1) ) ( if /I "%%v"=="JUSTBUILD" (set FBBUILD_BUILD_ONLY=1) ) @@ -32,7 +30,7 @@ for %%v in ( %* ) do ( ( if /I "%%v"=="SNAPSHOT" (set FB2_SNAPSHOT=1) ) ) -call :SETVCENV +@call setenvvar.bat %* if "%ERRLEV%"=="1" goto :END if defined FBBUILD_TEST_ONLY ( goto TEST_ENV & goto :EOF ) @@ -100,22 +98,10 @@ goto :END ::--------- -:SETVCENV -::=============================== -:: Set up the compiler environment - -@call setenvvar.bat %* -if "%ERRLEV%"=="1" goto :END - - -goto :END -::--------- - - :TEST_ENV ::=============================== :: Show variables -call :SETVCENV +@call setenvvar.bat %* if "%ERRLEV%"=="1" goto :END echo. set FB diff --git a/builds/win32/setenvvar.bat b/builds/win32/setenvvar.bat index 3c757307ef..6344ba40e6 100644 --- a/builds/win32/setenvvar.bat +++ b/builds/win32/setenvvar.bat @@ -10,14 +10,17 @@ @echo off -set FB_DBG= -set FB_CONFIG=release set FB_CLEAN= for %%v in ( %* ) do ( - ( if /I "%%v"=="DEBUG" ( (set FB_DBG=TRUE) && (set FB_CONFIG=debug) ) ) + ( if /I "%%v"=="DEBUG" ( (set FB_DBG=TRUE) && (set FBBUILD_BUILDTYPE=debug) ) ) ( if /I "%%v"=="CLEAN" (set FB_CLEAN=:rebuild) ) - ( if /I "%%v"=="RELEASE" ( (set FB_DBG=) && (set FB_CONFIG=release) ) ) + ( if /I "%%v"=="RELEASE" ( (set FB_DBG=) && (set FBBUILD_BUILDTYPE=release) ) ) +) + +@if not defined FBBUILD_BUILDTYPE ( + set FB_DBG= + set FBBUILD_BUILDTYPE=release ) :: Default target CPU architecture is the native environment @@ -130,7 +133,7 @@ for %%v in ( %* ) do ( @if "%FB_PROCESSOR_ARCHITECTURE%"=="AMD64" (set FB_TARGET_PLATFORM=x64) -@set FB_OUTPUT_DIR=%FB_ROOT_PATH%\output_%FB_TARGET_PLATFORM%_%FB_CONFIG% +@set FB_OUTPUT_DIR=%FB_ROOT_PATH%\output_%FB_TARGET_PLATFORM%_%FBBUILD_BUILDTYPE% @set FB_TEMP_DIR=%FB_ROOT_PATH%\temp\%FB_TARGET_PLATFORM% @set FB_INSTALL_SCRIPTS=%FB_ROOT_PATH%\builds\install\arch-specific\win32 @set FB_GEN_DIR=%FB_ROOT_PATH%\gen @@ -138,7 +141,7 @@ for %%v in ( %* ) do ( @set FB_ICU_SOURCE_BIN=%FB_ROOT_PATH%\extern\icu\%FB_TARGET_PLATFORM%\release\bin\ @set FIREBIRD_BOOT_BUILD=1 -@set FB_OBJ_DIR=%FB_TARGET_PLATFORM%\%FB_CONFIG% +@set FB_OBJ_DIR=%FB_TARGET_PLATFORM%\%FBBUILD_BUILDTYPE% @set FB_BOOT_BIN_DIR=%FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird @set FB_BIN_DIR=%FB_OUTPUT_DIR% diff --git a/examples/build_win32/make_all.bat b/examples/build_win32/make_all.bat index af37618d12..436b260f20 100644 --- a/examples/build_win32/make_all.bat +++ b/examples/build_win32/make_all.bat @@ -1,3 +1,4 @@ +call setenvvar.bat %* call make_api.bat call make_dyn.bat call make_stat.bat