mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Further cleanup for the batch scripts.
This commit is contained in:
+6
-8
@@ -24,8 +24,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
set THISDIR=%CD%
|
|
||||||
|
|
||||||
set PROJECT_NAME=IfcOpenShell
|
set PROJECT_NAME=IfcOpenShell
|
||||||
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
|
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
|
||||||
echo.
|
echo.
|
||||||
@@ -284,8 +282,8 @@ set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.msi
|
|||||||
:: NOTE/TODO 3.5.0 doesn't use MSI any longer, but exe: set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe
|
:: NOTE/TODO 3.5.0 doesn't use MSI any longer, but exe: set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe
|
||||||
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
|
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
|
||||||
REM Store Python versions to BuildDepsCache.txt for run-cmake.bat
|
REM Store Python versions to BuildDepsCache.txt for run-cmake.bat
|
||||||
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>"%THISDIR%\BuildDepsCache-%TARGET_ARCH%.txt"
|
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||||
echo PYTHONPATH=%PYTHONPATH%>>"%THISDIR%\BuildDepsCache-%TARGET_ARCH%.txt"
|
echo PYTHONPATH=%PYTHONPATH%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||||
|
|
||||||
cd "%DEPS_DIR%"
|
cd "%DEPS_DIR%"
|
||||||
call :DownloadFile https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER% "%DEPS_DIR%" %PYTHON_INSTALLER%
|
call :DownloadFile https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER% "%DEPS_DIR%" %PYTHON_INSTALLER%
|
||||||
@@ -325,7 +323,7 @@ IF EXIST "%DEPS_DIR%\swigwin\". robocopy "%DEPS_DIR%\swigwin" "%INSTALL_DIR%\swi
|
|||||||
|
|
||||||
:Successful
|
:Successful
|
||||||
echo.
|
echo.
|
||||||
call %THISDIR%\utils\cecho.cmd 0 10 "%PROJECT_NAME% dependencies built."
|
call %~dp0\utils\cecho.cmd 0 10 "%PROJECT_NAME% dependencies built."
|
||||||
goto :Finish
|
goto :Finish
|
||||||
|
|
||||||
:ErrorAndPrintUsage
|
:ErrorAndPrintUsage
|
||||||
@@ -333,12 +331,12 @@ echo.
|
|||||||
call :PrintUsage
|
call :PrintUsage
|
||||||
:Error
|
:Error
|
||||||
echo.
|
echo.
|
||||||
call %THISDIR%\utils\cecho.cmd 0 12 "An error occurred! Aborting!"
|
call %~dp0\utils\cecho.cmd 0 12 "An error occurred! Aborting!"
|
||||||
goto :Finish
|
goto :Finish
|
||||||
|
|
||||||
:Finish
|
:Finish
|
||||||
set PATH=%ORIGINAL_PATH%
|
set PATH=%ORIGINAL_PATH%
|
||||||
cd %THISDIR%
|
cd %~dp0
|
||||||
endlocal
|
endlocal
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
@@ -423,7 +421,7 @@ exit /b %RET%
|
|||||||
|
|
||||||
:: PrintUsage - Prints usage information
|
:: PrintUsage - Prints usage information
|
||||||
:PrintUsage
|
:PrintUsage
|
||||||
call %THISDIR%\utils\cecho.cmd 0 10 "Requirements for a successful execution:"
|
call %~dp0\utils\cecho.cmd 0 10 "Requirements for a successful execution:"
|
||||||
echo 1. Install PowerShell (preinstalled in Windows ^>= 7) and make sure 'powershell' is accessible from PATH.
|
echo 1. Install PowerShell (preinstalled in Windows ^>= 7) and make sure 'powershell' is accessible from PATH.
|
||||||
echo - https://support.microsoft.com/en-us/kb/968929
|
echo - https://support.microsoft.com/en-us/kb/968929
|
||||||
echo 2. Install Git and make sure 'git' is accessible from PATH.
|
echo 2. Install Git and make sure 'git' is accessible from PATH.
|
||||||
|
|||||||
+24
-33
@@ -23,9 +23,6 @@
|
|||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
:: TOOLS is the path where the Windows build scripts reside.
|
|
||||||
set TOOLS=%CD%
|
|
||||||
|
|
||||||
set GENERATOR=%1
|
set GENERATOR=%1
|
||||||
|
|
||||||
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
|
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
|
||||||
@@ -51,13 +48,13 @@ set GENERATOR_DEFAULT=%GENERATORS[1]%
|
|||||||
|
|
||||||
IF "!GENERATOR!"=="" (
|
IF "!GENERATOR!"=="" (
|
||||||
set GENERATOR=%GENERATOR_DEFAULT%
|
set GENERATOR=%GENERATOR_DEFAULT%
|
||||||
call utils\cecho.cmd 0 14 "vs-cfg.cmd: Warning: Generator not passed - using the default '`"%GENERATOR_DEFAULT%`'`t
|
call utils\cecho.cmd 0 14 "%~nx0: Warning: Generator not passed - using the default '`"%GENERATOR_DEFAULT%`'`t
|
||||||
)
|
)
|
||||||
|
|
||||||
FOR /l %%i in (0,1,9) DO (
|
FOR /l %%i in (0,1,9) DO (
|
||||||
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
|
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
|
||||||
)
|
)
|
||||||
call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
|
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:GeneratorValid
|
:GeneratorValid
|
||||||
@@ -68,32 +65,15 @@ set TARGET_ARCH=x86
|
|||||||
:: Visual Studio platform name, Win32 (i.e. x86) or x64.
|
:: Visual Studio platform name, Win32 (i.e. x86) or x64.
|
||||||
set VS_PLATFORM=Win32
|
set VS_PLATFORM=Win32
|
||||||
|
|
||||||
:: Split the string for closer inspection.
|
:: Find out VS version, VC versions and are we doing 64-bit or not.
|
||||||
:: TODO A bit clumsy and not dynamic when new VS is released, clean this up.
|
|
||||||
:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
|
:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
|
||||||
set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=%
|
set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=%
|
||||||
set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%
|
set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%
|
||||||
FOR %%i IN (%GENERATOR_SPLIT%) DO (
|
FOR %%i IN (%GENERATOR_SPLIT%) DO (
|
||||||
IF %%i==14 (
|
call :StrLength LEN %%i
|
||||||
set VS_VER=2015
|
IF !LEN!==1 set VC_VER=%%i
|
||||||
set VC_VER=14
|
IF !LEN!==2 set VC_VER=%%i
|
||||||
)
|
IF !LEN!==4 set VS_VER=%%i
|
||||||
IF %%i==12 (
|
|
||||||
set VS_VER=2013
|
|
||||||
set VC_VER=12
|
|
||||||
)
|
|
||||||
IF %%i==11 (
|
|
||||||
set VS_VER=2012
|
|
||||||
set VC_VER=11
|
|
||||||
)
|
|
||||||
IF %%i==10 (
|
|
||||||
set VS_VER=2010
|
|
||||||
set VC_VER=10
|
|
||||||
)
|
|
||||||
IF %%i==2008 (
|
|
||||||
set VS_VER=2008
|
|
||||||
set VC_VER=9
|
|
||||||
)
|
|
||||||
REM Are going to perform a 64-bit build?
|
REM Are going to perform a 64-bit build?
|
||||||
IF %%i==Win64 (
|
IF %%i==Win64 (
|
||||||
set ARCH_BITS=64
|
set ARCH_BITS=64
|
||||||
@@ -118,11 +98,11 @@ set BUILD_CFG_DEFAULT=%BUILD_CFG_RELWITHDEBINFO%
|
|||||||
|
|
||||||
IF "!BUILD_CFG!"=="" (
|
IF "!BUILD_CFG!"=="" (
|
||||||
set BUILD_CFG=%BUILD_CFG_DEFAULT%
|
set BUILD_CFG=%BUILD_CFG_DEFAULT%
|
||||||
call utils\cecho.cmd 0 14 "vs-cfg.cmd: Warning: BUILD_CFG not specified - using the default %BUILD_CFG_DEFAULT%"
|
call utils\cecho.cmd 0 14 "%~nx0: Warning: BUILD_CFG not specified - using the default %BUILD_CFG_DEFAULT%"
|
||||||
)
|
)
|
||||||
IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% (
|
IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% (
|
||||||
IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% (
|
IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% (
|
||||||
call utils\cecho.cmd 0 12 "vs-cfg.cmd: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed, aborting!"
|
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed, aborting!"
|
||||||
exit /b 1
|
exit /b 1
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -143,16 +123,27 @@ IF %BUILD_CFG%==Debug (
|
|||||||
set POSTFIX_UNDERSCORE_DEBUG=_debug
|
set POSTFIX_UNDERSCORE_DEBUG=_debug
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Populate path variables
|
:: Add utils to PATH
|
||||||
cd ..\
|
|
||||||
set ORIGINAL_PATH=%PATH%
|
set ORIGINAL_PATH=%PATH%
|
||||||
set PATH=%PATH%;%CD%\win\utils
|
set PATH=%PATH%;%~dp0\utils
|
||||||
|
|
||||||
:: Fetch and build the dependencies to a dedicated directory depending on the used VS version and target architecture.
|
:: Fetch and build the dependencies to a dedicated directory depending on the used VS version and target architecture.
|
||||||
:: NOTE For IfcOpenShell we can build all of our deps both x86 and x64 using different VS versions in the same directories
|
:: NOTE For IfcOpenShell we can build all of our deps both x86 and x64 using different VS versions in the same directories
|
||||||
:: so no need for -%VS_VER%-%TARGET_ARCH% postfix.
|
:: so no need for -%VS_VER%-%TARGET_ARCH% postfix.
|
||||||
:: set DEPS_DIR=%CD%\deps-%VS_VER%-%TARGET_ARCH%
|
:: set DEPS_DIR=%CD%\deps-%VS_VER%-%TARGET_ARCH%
|
||||||
|
pushd ..
|
||||||
set DEPS_DIR=%CD%\deps
|
set DEPS_DIR=%CD%\deps
|
||||||
set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-installed
|
set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-installed
|
||||||
REM set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-%DEBUG_OR_RELEASE_LOWERCASE%-installed
|
REM set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-%DEBUG_OR_RELEASE_LOWERCASE%-installed
|
||||||
cd %TOOLS%
|
popd
|
||||||
|
|
||||||
|
GOTO :EOF
|
||||||
|
:: http://geekswithblogs.net/SoftwareDoneRight/archive/2010/01/30/useful-dos-batch-functions-substring-and-length.aspx
|
||||||
|
:StrLength
|
||||||
|
set #=%2%
|
||||||
|
set length=0
|
||||||
|
:stringLengthLoop
|
||||||
|
if defined # (set #=%#:~1%&set /A length += 1&goto stringLengthLoop)
|
||||||
|
::echo the string is %length% characters long!
|
||||||
|
set "%~1=%length%"
|
||||||
|
GOTO :EOF
|
||||||
Reference in New Issue
Block a user