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.
|
||||
|
||||
set THISDIR=%CD%
|
||||
|
||||
set PROJECT_NAME=IfcOpenShell
|
||||
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
|
||||
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
|
||||
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
|
||||
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 PYTHONPATH=%PYTHONPATH%>>"%THISDIR%\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo PYTHONPATH=%PYTHONPATH%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
|
||||
cd "%DEPS_DIR%"
|
||||
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
|
||||
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
|
||||
|
||||
:ErrorAndPrintUsage
|
||||
@@ -333,12 +331,12 @@ echo.
|
||||
call :PrintUsage
|
||||
:Error
|
||||
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
|
||||
|
||||
:Finish
|
||||
set PATH=%ORIGINAL_PATH%
|
||||
cd %THISDIR%
|
||||
cd %~dp0
|
||||
endlocal
|
||||
goto :EOF
|
||||
|
||||
@@ -423,7 +421,7 @@ exit /b %RET%
|
||||
|
||||
:: PrintUsage - Prints usage information
|
||||
: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 - https://support.microsoft.com/en-us/kb/968929
|
||||
echo 2. Install Git and make sure 'git' is accessible from PATH.
|
||||
|
||||
+24
-33
@@ -23,9 +23,6 @@
|
||||
|
||||
@echo off
|
||||
|
||||
:: TOOLS is the path where the Windows build scripts reside.
|
||||
set TOOLS=%CD%
|
||||
|
||||
set GENERATOR=%1
|
||||
|
||||
:: 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!"=="" (
|
||||
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 (
|
||||
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
|
||||
|
||||
:GeneratorValid
|
||||
@@ -68,32 +65,15 @@ set TARGET_ARCH=x86
|
||||
:: Visual Studio platform name, Win32 (i.e. x86) or x64.
|
||||
set VS_PLATFORM=Win32
|
||||
|
||||
:: Split the string for closer inspection.
|
||||
:: TODO A bit clumsy and not dynamic when new VS is released, clean this up.
|
||||
:: Find out VS version, VC versions and are we doing 64-bit or not.
|
||||
:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
|
||||
set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=%
|
||||
set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%
|
||||
FOR %%i IN (%GENERATOR_SPLIT%) DO (
|
||||
IF %%i==14 (
|
||||
set VS_VER=2015
|
||||
set VC_VER=14
|
||||
)
|
||||
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
|
||||
)
|
||||
call :StrLength LEN %%i
|
||||
IF !LEN!==1 set VC_VER=%%i
|
||||
IF !LEN!==2 set VC_VER=%%i
|
||||
IF !LEN!==4 set VS_VER=%%i
|
||||
REM Are going to perform a 64-bit build?
|
||||
IF %%i==Win64 (
|
||||
set ARCH_BITS=64
|
||||
@@ -118,11 +98,11 @@ set BUILD_CFG_DEFAULT=%BUILD_CFG_RELWITHDEBINFO%
|
||||
|
||||
IF "!BUILD_CFG!"=="" (
|
||||
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_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
|
||||
))
|
||||
|
||||
@@ -143,16 +123,27 @@ IF %BUILD_CFG%==Debug (
|
||||
set POSTFIX_UNDERSCORE_DEBUG=_debug
|
||||
)
|
||||
|
||||
:: Populate path variables
|
||||
cd ..\
|
||||
:: Add utils to 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.
|
||||
:: 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.
|
||||
:: set DEPS_DIR=%CD%\deps-%VS_VER%-%TARGET_ARCH%
|
||||
pushd ..
|
||||
set DEPS_DIR=%CD%\deps
|
||||
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
|
||||
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