From e4a7d2a1496d32185ae7943bbdfde7370ada4fae Mon Sep 17 00:00:00 2001 From: Stinkfist0 Date: Tue, 28 Mar 2017 22:54:06 +0300 Subject: [PATCH] Windows/MSVC build scripts: support for VS 2017 CMake generators, update Boost to 1.63.0, update ICU download to 58.2 in order to have VS 2107 download available, configure Boost using generic MSVC instead of specific version, make sure to 'git fetch' before 'git checkout '. --- README.md | 2 +- win/build-deps.cmd | 39 +++++++++++++++++++++------------------ win/vs-cfg.cmd | 11 ++++++++--- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9235de6b4d..d77372219f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Prerequisites ------------- * Git * CMake (2.6 or newer) -* Windows: [Visual Studio] 2008 or newer (2017 not yet officially supported) with C++ toolset (or [Visual C++ Build Tools]) or [MSYS2] + MinGW +* Windows: [Visual Studio] 2008 or newer with C++ toolset (or [Visual C++ Build Tools]) or [MSYS2] + MinGW * *nix: GCC 4.7 or newer, or Clang (any version) Dependencies diff --git a/win/build-deps.cmd b/win/build-deps.cmd index 79c537617c..33604c53ef 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -139,7 +139,7 @@ cd "%DEPS_DIR%" :: Note all of the depedencies have approriate label so that user can easily skip something if wanted :: by modifying this file and using goto. :Boost -set BOOST_VERSION=1.59.0 +set BOOST_VERSION=1.63.0 :: DEPENDENCY_NAME is used for logging and DEPENDENCY_DIR for saving from some redundant typing set DEPENDENCY_NAME=Boost %BOOST_VERSION% set DEPENDENCY_DIR="%DEPS_DIR%\boost" @@ -159,13 +159,13 @@ call :ExtractArchive %BOOST_ZIP% "%DEPS_DIR%" "%DEPS_DIR%\boost" IF NOT %ERRORLEVEL%==0 GOTO :Error :: Build Boost build script -IF EXIST "%DEPS_DIR%\boost_%BOOST_VER%". ( +if not exist "%DEPS_DIR%\boost\project-config.jam". ( cd "%DEPS_DIR%" ren boost_%BOOST_VER% boost IF NOT EXIST "%DEPS_DIR%\boost\boost.css" GOTO :Error cd "%DEPS_DIR%\boost" call cecho.cmd 0 13 "Building Boost build script." - call bootstrap vc%VC_VER% + call bootstrap msvc IF NOT %ERRORLEVEL%==0 GOTO :Error ) @@ -174,38 +174,40 @@ set BOOST_LIBS=--with-system --with-regex --with-thread --with-program_options - cd "%DEPS_DIR%\boost" call cecho.cmd 0 13 "Building %DEPENDENCY_NAME% %BOOST_LIBS% Please be patient, this will take a while." IF EXIST "%DEPS_DIR%\boost\bin.v2\project-cache.jam" del "%DEPS_DIR%\boost\bin.v2\project-cache.jam" -call .\b2 toolset=msvc-%VC_VER%.0 runtime-link=static address-model=%ARCH_BITS% -j%IFCOS_NUM_BUILD_PROCS% ^ +call .\b2 toolset=msvc runtime-link=static address-model=%ARCH_BITS% -j%IFCOS_NUM_BUILD_PROCS% ^ variant=%DEBUG_OR_RELEASE_LOWERCASE% %BOOST_LIBS% stage --stagedir=stage/vs%VS_VER%-%VS_PLATFORM% IF NOT %ERRORLEVEL%==0 GOTO :Error :ICU set DEPENDENCY_NAME=ICU set DEPENDENCY_DIR=N/A -set ICU_ZIP=icu-55.1-vs%VS_VER%.7z +set ICU_VER=58.2 +set ICU_ZIP=icu-%ICU_VER%-vs%VS_VER%.7z cd "%DEPS_DIR%" call :DownloadFile http://www.npcglib.org/~stathis/downloads/%ICU_ZIP% "%DEPS_DIR%" %ICU_ZIP% IF NOT %ERRORLEVEL%==0 GOTO :Error call :ExtractArchive %ICU_ZIP% "%DEPS_DIR%" "%INSTALL_DIR%\icu" IF NOT %ERRORLEVEL%==0 GOTO :Error :: Rename lib and bin directories to predictable form -IF EXIST "%DEPS_DIR%\icu-55.1-vs%VS_VER%". ( - pushd "%DEPS_DIR%\icu-55.1-vs%VS_VER%" +IF EXIST "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%". ( + pushd "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%" IF EXIST bin. ren bin bin%ARCH_BITS%" IF EXIST lib. ren lib lib%ARCH_BITS%" popd ) -IF EXIST "%DEPS_DIR%\icu-55.1-vs%VS_VER%\". ( - robocopy "%DEPS_DIR%\icu-55.1-vs%VS_VER%\include" "%INSTALL_DIR%\icu\include" /E /IS /njh /njs +IF EXIST "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\". ( + robocopy "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\include" "%INSTALL_DIR%\icu\include" /E /IS /njh /njs IF NOT EXIST "%INSTALL_DIR%\icu\lib". mkdir "%INSTALL_DIR%\icu\lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicutest%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutest%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicutu%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutu%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuuc%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuuc%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicudt%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icudt%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuin%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuin%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuio%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuio%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicule%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icule%POSTFIX_D%.lib" - copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\siculx%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\iculx%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicutest%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutest%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicutu%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutu%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicuuc%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuuc%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicudt%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icudt%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicuin%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuin%POSTFIX_D%.lib" + copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicuio%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuio%POSTFIX_D%.lib" + REM NOTE not available in 58.2 at least, nor needed by us. + REM copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\sicule%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icule%POSTFIX_D%.lib" + REM copy /y "%DEPS_DIR%\icu-%ICU_VER%-vs%VS_VER%\lib%ARCH_BITS%\siculx%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\iculx%POSTFIX_D%.lib" ) :OpenCOLLADA @@ -473,7 +475,7 @@ if not exist "%~2". ( popd exit /b %RET% -:: GitCloneAndCheckoutRevision - Clones a Git repository and checks out a specific revision +:: 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 :GitCloneAndCheckoutRevision @@ -489,6 +491,7 @@ if not exist "%~2". ( set RET=0 ) pushd "%2" +call git fetch call cecho.cmd 0 13 "Checking out %DEPENDENCY_NAME% revision %3." call git checkout %3 set RET=%ERRORLEVEL% diff --git a/win/vs-cfg.cmd b/win/vs-cfg.cmd index c7a6c90ede..992de2ef5a 100644 --- a/win/vs-cfg.cmd +++ b/win/vs-cfg.cmd @@ -43,7 +43,11 @@ set GENERATORS[6]="Visual Studio 12 2013 Win64" set GENERATORS[7]="Visual Studio 12 2013" set GENERATORS[8]="Visual Studio 14 2015 Win64" set GENERATORS[9]="Visual Studio 14 2015" -set LAST_GENERATOR_IDX=9 +:: NOTE VC version for VS 2017 is not 15 but 14.1: have to wait and see +:: if CMake generator string is updated to reflect this. +set GENERATORS[10]="Visual Studio 15 2017 Win64" +set GENERATORS[11]="Visual Studio 15 2017" +set LAST_GENERATOR_IDX=11 set STEP=2 :: Is generator shorthand used? @@ -67,7 +71,8 @@ echo(!GENERATOR! | findstr /c:"vs20" >nul && ( :: Deduce desired architecture from the location of cl.exe :: TODO harmless "INFO: Could not find files for the given pattern(s)." spam if cl.exe not in path -where cl.exe | findstr /c:"amd64" >nul +:: Look for path with either "amd64" or "x64" (VS 2017 and newer) +where cl.exe | findstr "amd64 x64" >nul set START=%ERRORLEVEL% IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" ( @@ -108,7 +113,7 @@ set TARGET_ARCH=x86 :: Visual Studio platform name, Win32 (i.e. x86) or x64. set VS_PLATFORM=Win32 -:: Find out VS version, VC versions and are we doing 64-bit or not. +:: Find out VS (e.g. 2015) and VC (e.g. 14) versions and are we targeting x64 or not (x86). :: VS_VER and VC_VER are convenience variables used f.ex. for filenames. set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=% set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%