mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Merge branch 'v0.8.0' into ifcmax/initial-refresh
# Conflicts: # src/ifcmax/CMakeLists.txt
This commit is contained in:
+56
-113
@@ -98,7 +98,8 @@ IF NOT DEFINED IFCOS_NUM_BUILD_PROCS set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCES
|
||||
:: For subroutines
|
||||
REM /clp:ErrorsOnly;WarningsOnly
|
||||
:: Note BUILD_TYPE not passed, Clean e.g. wouldn't delete the installed files.
|
||||
set MSBUILD_CMD=MSBuild.exe /nologo /m:%IFCOS_NUM_BUILD_PROCS%
|
||||
set MSBUILD_MULTIPROC=/m /p:CL_MPCount=%IFCOS_NUM_BUILD_PROCS% /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true
|
||||
set MSBUILD_CMD=MSBuild.exe /nologo %MSBUILD_MULTIPROC%
|
||||
|
||||
echo.
|
||||
|
||||
@@ -281,7 +282,7 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\proj-9.2.1" ^
|
||||
-DBUILD_SHARED_LIBS=Off ^
|
||||
-DBUILD_TESTING=Off
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\PROJ.sln" %BUILD_CFG%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -378,7 +379,7 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%HDF5_INSTALL_NAME%" ^
|
||||
-DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DHDF5_BUILD_UTILS=OFF ^
|
||||
-DHDF5_BUILD_CPP_LIB=ON
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\HDF5.sln" %DEBUG_OR_RELEASE%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -465,7 +466,7 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%"
|
||||
-DLIBXML2_LIBRARIES="" -DLIBXML2_INCLUDE_DIR="" -DPCRE_INCLUDE_DIR="" -DPCRE_LIBRARIES=""
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
REM IF NOT EXIST "%DEPS_DIR%\OpenCOLLADA\%BUILD_DIR%\lib\%DEBUG_OR_RELEASE%\OpenCOLLADASaxFrameworkLoader.lib".
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OPENCOLLADA.sln" %DEBUG_OR_RELEASE%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -487,25 +488,6 @@ echo OCC_INSTALL_DIR=%DEPENDENCY_INSTALL_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
|
||||
call :CheckInstallation
|
||||
if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
|
||||
|
||||
:: OCCT has many dependencies but FreeType is the only mandatory
|
||||
set DEPENDENCY_NAME=FreeType
|
||||
set DEPENDENCY_DIR=%DEPS_DIR%\freetype-2.7.1
|
||||
set FREETYPE_ZIP=VER-2-7-1.zip
|
||||
cd "%DEPS_DIR%"
|
||||
call :DownloadFile https://github.com/freetype/freetype/archive/refs/tags/%FREETYPE_ZIP% "%DEPS_DIR%" %FREETYPE_ZIP%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :ExtractArchive %FREETYPE_ZIP% "%DEPS_DIR%" "%DEPENDENCY_DIR%"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
if exist "%DEPS_DIR%\freetype-VER-2-7-1" ren "%DEPS_DIR%\freetype-VER-2-7-1" "freetype-2.7.1"
|
||||
cd "%DEPENDENCY_DIR%"
|
||||
:: NOTE FreeType is built as a static library by default
|
||||
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\freetype"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\freetype.sln" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
set DEPENDENCY_NAME=Open CASCADE %OCCT_VERSION%
|
||||
set DEPENDENCY_DIR=%DEPS_DIR%\occt_git
|
||||
set DEPENDENCY_INSTALL_NAME=%OCCT_DEPENDENCY_INSTALL_NAME%
|
||||
@@ -528,7 +510,7 @@ cd "%DEPENDENCY_DIR%"
|
||||
:: Temporarily explicitly set `CMAKE_DEBUG_POSTFIX` to empty to override it's perviously being set to `d`.
|
||||
:: OCCT don't need it, since it's layout is separating debug and release build by different folders.
|
||||
call :RunCMake -DINSTALL_DIR="%DEPENDENCY_INSTALL_DIR%" -DBUILD_LIBRARY_TYPE="Static" -DCMAKE_DEBUG_POSTFIX="" ^
|
||||
-DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR="%INSTALL_DIR%\freetype" ^
|
||||
-DBUILD_MODULE_Draw=0 -DUSE_FREETYPE=OFF ^
|
||||
-DBUILD_USE_PCH=ON
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
@@ -539,7 +521,7 @@ IF %ARCH_BITS%==32 (
|
||||
)
|
||||
)
|
||||
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCCT.sln" %BUILD_CFG%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
:: If `inc` is present in installation folder, then installation takes much longer
|
||||
@@ -626,7 +608,7 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%DEPENDENCY_INSTALL_DIR%" ^
|
||||
-DWITH_PCRE=OFF ^
|
||||
-DBISON_EXECUTABLE="%DEPS_DIR%\%WIN_FLEX_BISON%\win_bison.exe"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\swig.sln" Release
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" Release
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" Release
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -649,7 +631,7 @@ git apply --ignore-whitespace "%~dp0patches\cgal_no_zlib.patch"
|
||||
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\cgal" ^
|
||||
-DCGAL_HEADER_ONLY=On
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\CGAL.sln" %BUILD_CFG%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -685,7 +667,7 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
cd "%DEPENDENCY_DIR%"\build\cmake
|
||||
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\zstd" -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%\zstd.sln" %BUILD_CFG%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -726,7 +708,7 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%"
|
||||
-DPORTABLE=1 ^
|
||||
-DCMAKE_DEBUG_POSTFIX="_d"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\rocksdb.sln" %BUILD_CFG%
|
||||
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -741,7 +723,7 @@ call :MarkInstallation
|
||||
:: call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\tbb" ^
|
||||
:: -DBUILD_SHARED_LIBS=Off
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
:: call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\TBB.sln" %BUILD_CFG%
|
||||
:: call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
:: call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -765,7 +747,7 @@ call :MarkInstallation
|
||||
:: -DPXR_BUILD_TESTS=FALSE ^
|
||||
:: -DBUILD_SHARED_LIBS=Off ^
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
:: call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\USD.sln" %BUILD_CFG%
|
||||
:: call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
:: call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
@@ -811,76 +793,31 @@ exit %IFCOS_SCRIPT_RET%
|
||||
|
||||
:: DownloadFile - Downloads a file using PowerShell
|
||||
:: Params: %1 url, %2 destinationDir, %3 filename
|
||||
:: Required vars:
|
||||
:: - DEPENDENCY_NAME
|
||||
:DownloadFile
|
||||
mkdir "%2"
|
||||
pushd "%2"
|
||||
if not exist "%~3". (
|
||||
call cecho.cmd 0 13 "Downloading %DEPENDENCY_NAME% into %~2."
|
||||
powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; $webClient = new-object System.Net.WebClient; $webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials; $webClient.DownloadFile('%1', '%3')"
|
||||
REM Old wget version in case someone has problem with PowerShell: wget --no-check-certificate %1
|
||||
) else (
|
||||
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already downloaded. Skipping."
|
||||
)
|
||||
set RET=%ERRORLEVEL%
|
||||
set LAST_ACTION=DownloadFile '%DEPENDENCY_NAME%'.
|
||||
popd
|
||||
exit /b %RET%
|
||||
%PWSH_TOOLS% download_file "%DEPENDENCY_NAME%" "%1" "%2" "%3"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
exit /b 0
|
||||
|
||||
:: ExtractArchive - Extracts an archive file using 7-zip
|
||||
:: Params: %1 filename, %2 destinationDir, %3 dirAfterExtraction
|
||||
:: Required vars:
|
||||
:: - DEPENDENCY_NAME
|
||||
:ExtractArchive
|
||||
if not exist "%~3". (
|
||||
call cecho.cmd 0 13 "Extracting %DEPENDENCY_NAME% into %~2 from %1"
|
||||
7za x %1 -y -o%2 > nul
|
||||
) else (
|
||||
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already extracted into %~3. Skipping."
|
||||
)
|
||||
set RET=%ERRORLEVEL%
|
||||
set LAST_ACTION=ExtractArchive '%DEPENDENCY_NAME%'.
|
||||
exit /b %RET%
|
||||
|
||||
:: GitCloneOrPullRepository - Clones or pulls (if repository already cloned) a Git repository
|
||||
:: Params: %1 gitUrl, %2 destDir
|
||||
:: F.ex. call :GitCloneRepository https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPS_DIR%\OpenCOLLADA\"
|
||||
:GitCloneOrPullRepository
|
||||
if not exist "%~2". (
|
||||
call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2."
|
||||
pushd "%DEPS_DIR%"
|
||||
call git clone %1 %2
|
||||
set RET=!ERRORLEVEL!
|
||||
) else (
|
||||
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned. Pulling latest changes."
|
||||
git reset --hard
|
||||
pushd %2
|
||||
call git pull
|
||||
set RET=0
|
||||
)
|
||||
popd
|
||||
exit /b %RET%
|
||||
%PWSH_TOOLS% extract_file "%DEPENDENCY_NAME%" "%1" "%2" "%3"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
exit /b 0
|
||||
|
||||
:: GitCloneAndCheckoutRevision - Clones a Git repository and checks out a specific revision or tag
|
||||
:: Params: %1 gitUrl, %2 destDir, %3 revision
|
||||
:: F.ex. call :GitCloneAndCheckoutRevision https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPENDENCY_DIR%" 064a60b65c2c31b94f013820856bc84fb1937cc6
|
||||
:: Required vars:
|
||||
:: - DEPENDENCY_NAME
|
||||
:GitCloneAndCheckoutRevision
|
||||
if not exist "%~2". (
|
||||
call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2."
|
||||
pushd "%DEPS_DIR%"
|
||||
call git clone %1 %2
|
||||
set RET=!ERRORLEVEL!
|
||||
if not "!RET!"=="0" exit /b !RET!
|
||||
popd
|
||||
) else (
|
||||
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned."
|
||||
set RET=0
|
||||
)
|
||||
pushd "%2"
|
||||
call git fetch
|
||||
call cecho.cmd 0 13 "Checking out %DEPENDENCY_NAME% revision %3."
|
||||
call git reset --hard
|
||||
call git checkout %3
|
||||
set RET=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RET%
|
||||
%PWSH_TOOLS% git_clone_and_checkout_revision "%DEPENDENCY_NAME%" "%1" "%2" "%3"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
exit /b 0
|
||||
|
||||
:: RunCMake - Runs CMake for a CMake-based project
|
||||
:: Params: %* cmakeOptions
|
||||
@@ -894,20 +831,36 @@ pushd %BUILD_DIR%
|
||||
:: cache always e.g. when we've had new changes in the repository.
|
||||
IF %BUILD_TYPE%==Rebuild IF EXIST CMakeCache.txt. del CMakeCache.txt
|
||||
|
||||
set VS_TOOLSET_CMAKE_ARG=
|
||||
IF NOT "%VS_TOOLSET_HOST%"=="" (
|
||||
cmake .. -G %GENERATOR% -A %VS_PLATFORM% -T %VS_TOOLSET_HOST% %*
|
||||
) ELSE (
|
||||
cmake .. -G %GENERATOR% -A %VS_PLATFORM% %*
|
||||
set VS_TOOLSET_CMAKE_ARG=-T %VS_TOOLSET_HOST%
|
||||
)
|
||||
|
||||
set COMMAND=cmake .. -G %GENERATOR% -A %VS_PLATFORM% %VS_TOOLSET_CMAKE_ARG% %*
|
||||
echo %COMMAND%
|
||||
%COMMAND%
|
||||
set RET=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RET%
|
||||
|
||||
:: TODO add BuildCMakeProject which utilizes cmake --build
|
||||
:: Params: %1 buildDir, %2 configuration
|
||||
:: Required vars:
|
||||
:: - DEPENDENCY_NAME
|
||||
:BuildCMakeProject
|
||||
pushd %1
|
||||
call cecho.cmd 0 13 "Building %DEPENDENCY_NAME%. Please be patient, this will take a while."
|
||||
set COMPILE_WITH_WPO_SETTING=
|
||||
IF NOT %COMPILE_WITH_WPO%==FALSE (
|
||||
set COMPILE_WITH_WPO_SETTING=;WholeProgramOptimization=TRUE
|
||||
)
|
||||
set COMMAND=cmake --build . --config %2 -- %MSBUILD_MULTIPROC%
|
||||
echo %COMMAND%
|
||||
%COMMAND%
|
||||
set RET=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RET%
|
||||
|
||||
:: BuildSolution - Builds/Rebuilds/Cleans a solution using MSBuild
|
||||
:: Params: %1 solutioName, %2 configuration
|
||||
:: Params: %1 solutionName, %2 configuration
|
||||
:BuildSolution
|
||||
IF [%~3]==[] (
|
||||
set TARGET=%BUILD_TYPE%
|
||||
@@ -929,23 +882,13 @@ IF NOT %COMPILE_WITH_WPO%==FALSE (
|
||||
%MSBUILD_CMD% %1 /p:configuration=%2;platform=%VS_PLATFORM%%COMPILE_WITH_WPO_SETTING% /t:"%TARGET%"
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:: InstallCMakeProject - Builds the INSTALL project of CMake-based project
|
||||
:: Params: %1 buildDir, %2 == configuration
|
||||
:: NOTE the actual install dir is set during cmake run.
|
||||
:: TODO Utilize cmake --build --target INSTALL
|
||||
:: Params: %1 buildDir, %2 configuration
|
||||
:: Required vars:
|
||||
:: - DEPENDENCY_NAME
|
||||
:InstallCMakeProject
|
||||
pushd %1
|
||||
call cecho.cmd 0 13 "Installing %2 %DEPENDENCY_NAME%. Please be patient, this will take a while."
|
||||
|
||||
:: whole program optimization avoids Visual C++ hanging when compiling 32-bit release OCCT up to version 7.4.0
|
||||
set COMPILE_WITH_WPO_SETTING=
|
||||
IF NOT %COMPILE_WITH_WPO%==FALSE (
|
||||
set COMPILE_WITH_WPO_SETTING=;WholeProgramOptimization=TRUE
|
||||
)
|
||||
%MSBUILD_CMD% INSTALL.%VCPROJ_FILE_EXT% /p:configuration=%2;platform=%VS_PLATFORM%%COMPILE_WITH_WPO_SETTING%
|
||||
set RET=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RET%
|
||||
%PWSH_TOOLS% install_cmake_project "%DEPENDENCY_NAME%" "%1" "%2"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
exit /b 0
|
||||
|
||||
:: Checks whether a dependency is already installed for the specified config
|
||||
:: Doesn't work for dependencies, only for those that need separate Debug/Release installs.
|
||||
|
||||
@@ -58,7 +58,8 @@ call cecho.cmd 0 13 "* IFCOS_NUM_BUILD_PROCS`t= %IFCOS_NUM_BUILD_PROCS%"
|
||||
echo.
|
||||
|
||||
call cecho.cmd 0 13 "Installing %VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME%"
|
||||
cmake --build ..\%BUILD_DIR% --target INSTALL -- /nologo /m:%IFCOS_NUM_BUILD_PROCS% /p:Platform=%VS_PLATFORM% ^
|
||||
set MSBUILD_MULTIPROC=/m /p:CL_MPCount=%IFCOS_NUM_BUILD_PROCS% /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true
|
||||
cmake --build ..\%BUILD_DIR% --target INSTALL -- /nologo %MSBUILD_MULTIPROC% /p:Platform=%VS_PLATFORM% ^
|
||||
/p:Configuration=%BUILD_CFG% %3 %4 %5 %6 %7 %8 %9
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
|
||||
|
||||
+98
-2
@@ -18,7 +18,7 @@ function mark {
|
||||
if (Test-Path -Path $marker_filepath) {
|
||||
return
|
||||
}
|
||||
echo "Marking installation in '$installation_dir' with '$ENV:MARKER_FILE'."
|
||||
cecho.cmd 0 13 "Marking installation in '$installation_dir' with '$ENV:MARKER_FILE'."
|
||||
New-Item -Path $marker_filepath -ItemType File | Out-Null
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ function mark_based_on_artifacts {
|
||||
if (Test-Path -Path $marker_filepath) {
|
||||
return
|
||||
}
|
||||
echo "Found artifact '$artifact' for dependency '$dependency_name' $env:BUILD_CFG."
|
||||
cecho.cmd 0 13 "Found artifact '$artifact' for dependency '$dependency_name' $env:BUILD_CFG."
|
||||
& mark $installation_dir
|
||||
}
|
||||
|
||||
@@ -125,6 +125,102 @@ function setup_build_cfg {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function extract_file {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dependency_name,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$filename,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$destination_dir,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dir_after_extraction
|
||||
)
|
||||
if (Test-Path -Path "$dir_after_extraction") {
|
||||
cecho.cmd 0 13 "$dependency_name already extracted into '$dir_after_extraction'. Skipping."
|
||||
exit 0
|
||||
}
|
||||
cecho.cmd 0 13 "Extracting $dependency_name into '$destination_dir' from '$filename'."
|
||||
7za x "$filename" -o"$destination_dir"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
function download_file {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dependency_name,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$url,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$destination_dir,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$filename
|
||||
)
|
||||
mkdir "$destination_dir" -Force | Out-Null
|
||||
pushd "$destination_dir"
|
||||
if (Test-Path -Path "$filename") {
|
||||
cecho.cmd 0 13 "$dependency_name already downloaded. Skipping."
|
||||
exit 0
|
||||
}
|
||||
|
||||
cecho.cmd 0 13 "Downloading $dependency_name into '$destination_dir'"
|
||||
Invoke-WebRequest $url -OutFile $filename
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# Required env variables:
|
||||
# - DEPS_DIR
|
||||
function git_clone_and_checkout_revision {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dependency_name,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$git_url,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dest_dir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$revision
|
||||
)
|
||||
if (Test-Path -Path "$dest_dir") {
|
||||
cecho.cmd 0 13 "Cloning $dependency_name is already cloned."
|
||||
exit 0
|
||||
}
|
||||
cecho.cmd 0 13 "Cloning $dependency_name into '$dest_dir'."
|
||||
pushd "$env:DEPS_DIR"
|
||||
git clone $git_url $dest_dir
|
||||
popd
|
||||
|
||||
pushd "$dest_dir"
|
||||
git fetch
|
||||
cecho.cmd 0 13 "Checking out $dependency_name revision $revision."
|
||||
git reset --hard
|
||||
git checkout $revision
|
||||
popd
|
||||
exit 0
|
||||
}
|
||||
|
||||
function install_cmake_project {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$dependency_name,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$build_dir,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$configuration
|
||||
)
|
||||
pushd "$build_dir"
|
||||
cecho.cmd 0 13 "Installing $dependency_name ($configuration). Please be patient, this may take a while."
|
||||
$command = "cmake --install . --config $configuration"
|
||||
cecho.cmd 0 13 "$command"
|
||||
Invoke-Expression $command
|
||||
popd
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
function main {
|
||||
& setup_build_cfg
|
||||
# Dispatch command.
|
||||
|
||||
Reference in New Issue
Block a user